From 607c78aa062e9c329b7a69a9da8bb8863589b172 Mon Sep 17 00:00:00 2001 From: Cristian Scheid Date: Wed, 1 Apr 2026 13:22:30 -0300 Subject: [PATCH] fix(file-search): use default limit to search query if not provided on request body Signed-off-by: Cristian Scheid --- apps/dav/lib/Files/FileSearchBackend.php | 3 ++- apps/dav/tests/unit/Files/FileSearchBackendTest.php | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php index 16e6e6eb0d2..7c44e132c08 100644 --- a/apps/dav/lib/Files/FileSearchBackend.php +++ b/apps/dav/lib/Files/FileSearchBackend.php @@ -343,6 +343,7 @@ class FileSearchBackend implements ISearchBackend { }, $query->orderBy); $limit = $query->limit; + $maxResults = $limit->maxResults !== 0 ? (int)$limit->maxResults : 100; $offset = $limit->firstResult; $limitHome = false; @@ -370,7 +371,7 @@ class FileSearchBackend implements ISearchBackend { return new SearchQuery( $operators, - (int)$limit->maxResults, + $maxResults, $offset, $orders, $this->user, diff --git a/apps/dav/tests/unit/Files/FileSearchBackendTest.php b/apps/dav/tests/unit/Files/FileSearchBackendTest.php index c6d6f85347b..df98df60e98 100644 --- a/apps/dav/tests/unit/Files/FileSearchBackendTest.php +++ b/apps/dav/tests/unit/Files/FileSearchBackendTest.php @@ -97,7 +97,7 @@ class FileSearchBackendTest extends TestCase { 'name', 'foo' ), - 0, + 100, 0, [], $this->user @@ -126,7 +126,7 @@ class FileSearchBackendTest extends TestCase { 'mimetype', 'foo' ), - 0, + 100, 0, [], $this->user @@ -155,7 +155,7 @@ class FileSearchBackendTest extends TestCase { 'size', 10 ), - 0, + 100, 0, [], $this->user @@ -184,7 +184,7 @@ class FileSearchBackendTest extends TestCase { 'mtime', 10 ), - 0, + 100, 0, [], $this->user @@ -213,7 +213,7 @@ class FileSearchBackendTest extends TestCase { 'mimetype', FileInfo::MIMETYPE_FOLDER ), - 0, + 100, 0, [], $this->user