-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jmap_calendar: return unsupportedFilter for too large SQL queries
Signed-off-by: Robert Stepanek <[email protected]>
- Loading branch information
Showing
2 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
cassandane/tiny-tests/JMAPCalendars/calendarevent_query_unsupported
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!perl | ||
use Cassandane::Tiny; | ||
use Data::UUID; | ||
|
||
sub test_calendarevent_query_unsupported | ||
:min_version_3_9 :needs_component_jmap | ||
{ | ||
my ($self) = @_; | ||
|
||
my $jmap = $self->{jmap}; | ||
my $caldav = $self->{caldav}; | ||
my $uuidgen = Data::UUID->new; | ||
|
||
xlog $self, "Run squatter"; | ||
$self->{instance}->run_command({cyrus => 1}, 'squatter'); | ||
|
||
my $filter = { | ||
operator => 'OR', | ||
conditions => [] | ||
}; | ||
|
||
# evoke a sqlite error for too complex expression trees. | ||
# this filter is non- | ||
for (1 .. 1001) { # this is the internal sqlite3 limit | ||
push(@{$filter->{conditions}}, { | ||
uid => $uuidgen->create_str, | ||
after => '2023-03-04T14:00:00', | ||
}); | ||
} | ||
|
||
my $res = $jmap->CallMethods([ | ||
['CalendarEvent/query', { | ||
filter => $filter | ||
}, 'R1'], | ||
]); | ||
$self->assert_str_equals("unsupportedFilter", $res->[0][1]{type}); | ||
|
||
$self->{instance}->getsyslog(); # ignore seen.db DBERROR | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters