Skip to content

Commit f84f080

Browse files
authored
Merge pull request #52190 from nextcloud/backport/49695/stable29
2 parents 9ba5c1b + ba1321a commit f84f080

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/private/Files/Cache/Updater.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,15 @@ public function renameFromStorage(IStorage $sourceStorage, $source, $target) {
205205
*/
206206
public function copyFromStorage(IStorage $sourceStorage, string $source, string $target): void {
207207
$this->copyOrRenameFromStorage($sourceStorage, $source, $target, function (ICache $sourceCache, ICacheEntry $sourceInfo) use ($target) {
208-
$this->cache->copyFromCache($sourceCache, $sourceInfo, $target);
208+
$parent = dirname($target);
209+
$parentInCache = $this->cache->inCache($parent);
210+
if (!$parentInCache) {
211+
$parentData = $this->scanner->scan($parent, Scanner::SCAN_SHALLOW, -1, false);
212+
$parentInCache = $parentData !== null;
213+
}
214+
if ($parentInCache) {
215+
$this->cache->copyFromCache($sourceCache, $sourceInfo, $target);
216+
}
209217
});
210218
}
211219

0 commit comments

Comments
 (0)