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);