From 55e9491011f8751fc09802180202e8ab1053374f Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Tue, 5 Aug 2025 19:36:18 +0200 Subject: [PATCH] fix(lib): get fileinfo before locking Signed-off-by: skjnldsv --- lib/private/legacy/OC_Files.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php index f719e05a24cdd..23ea252d98fb8 100644 --- a/lib/private/legacy/OC_Files.php +++ b/lib/private/legacy/OC_Files.php @@ -109,7 +109,6 @@ public static function get($dir, $files, $params = null) { } } - self::lockFiles($view, $dir, $files); $numberOfFiles = 0; $fileSize = 0; @@ -132,7 +131,11 @@ public static function get($dir, $files, $params = null) { } } - //Dispatch an event to see if any apps have problem with download + // Lock the files AFTER we retrieved the files infos + // this allows us to ensure they're still available + self::lockFiles($view, $dir, $files); + + // Dispatch an event to see if any apps have problem with download $event = new BeforeZipCreatedEvent($dir, is_array($files) ? $files : [$files]); $dispatcher = \OCP\Server::get(IEventDispatcher::class); $dispatcher->dispatchTyped($event);