diff options
author | Robin Appelman <robin@icewind.nl> | 2024-12-06 17:45:07 +0100 |
---|---|---|
committer | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2025-04-15 18:05:36 +0200 |
commit | a4d2af5155fecc031ffe634defd57baf6c2ad396 (patch) | |
tree | 8454a136ccc41adeb2f17795387f4ce94c796f42 | |
parent | 4fbeba30388c27dba0a1fdc0e43cf4d606f9599b (diff) | |
download | nextcloud-server-backport/49695/stable30.tar.gz nextcloud-server-backport/49695/stable30.zip |
fix: only do cache copy in updater if the parent folder should be in cachebackport/49695/stable30
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | lib/private/Files/Cache/Updater.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php index 578f4a8b1e7..e82b079d0c5 100644 --- a/lib/private/Files/Cache/Updater.php +++ b/lib/private/Files/Cache/Updater.php @@ -185,7 +185,15 @@ class Updater implements IUpdater { */ public function copyFromStorage(IStorage $sourceStorage, string $source, string $target): void { $this->copyOrRenameFromStorage($sourceStorage, $source, $target, function (ICache $sourceCache, ICacheEntry $sourceInfo) use ($target) { - $this->cache->copyFromCache($sourceCache, $sourceInfo, $target); + $parent = dirname($target); + $parentInCache = $this->cache->inCache($parent); + if (!$parentInCache) { + $parentData = $this->scanner->scan($parent, Scanner::SCAN_SHALLOW, -1, false); + $parentInCache = $parentData !== null; + } + if ($parentInCache) { + $this->cache->copyFromCache($sourceCache, $sourceInfo, $target); + } }); } |