From d869f1f60f01be4b7f0c7a9b9b5c7c5fb20c3601 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 c14f7469a8497..753110aa9264b 100644 --- a/lib/private/legacy/OC_Files.php +++ b/lib/private/legacy/OC_Files.php @@ -144,7 +144,6 @@ public static function get($dir, $files, $params = null) { } } - self::lockFiles($view, $dir, $files); $numberOfFiles = 0; $fileSize = 0; @@ -167,7 +166,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);