Skip to content

Commit f45c8ed

Browse files
committed
debug: Try to fix tests
Signed-off-by: Louis Chemineau <louis@chmn.me>
1 parent 6a0e117 commit f45c8ed

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/private/Files/Cache/Updater.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,14 @@ private function copyOrRenameFromStorage(IStorage $sourceStorage, string $source
200200
$sourceInfo = $sourceCache->get($source);
201201

202202
if ($sourceInfo !== false) {
203+
// Remove existing cache entry to no reuse the fileId.
203204
if ($this->cache->inCache($target)) {
204-
$this->cache->remove($target);
205+
$existingCacheInfo = $this->cache->get($target);
206+
// Do not remove the existing target if it has just been created.
207+
// It was probably created by the same operation and we want to keep the fileId.
208+
if (time() - $existingCacheInfo->getMTime() > 1) {
209+
$this->cache->remove($target);
210+
}
205211
}
206212

207213
$operation($sourceCache, $sourceInfo);

0 commit comments

Comments
 (0)