diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php index ee320950af4d3..3f619ccba10a2 100644 --- a/lib/private/Files/Cache/Updater.php +++ b/lib/private/Files/Cache/Updater.php @@ -202,17 +202,10 @@ private function copyOrRenameFromStorage(IStorage $sourceStorage, string $source if ($sourceInfo !== false) { // Remove existing cache entry to no reuse the fileId. if ($this->cache->inCache($target)) { - $existingCacheInfo = $this->cache->get($target); - // Do not remove the existing target if it has just been created. - // It was probably created by the same operation and we want to keep the fileId. - if (time() - $existingCacheInfo->getMTime() > 1) { - $this->cache->remove($target); - } + $this->cache->remove($target); } - if (!$this->cache->inCache($target)) { - $operation($sourceCache, $sourceInfo); - } + $operation($sourceCache, $sourceInfo); $sourceExtension = pathinfo($source, PATHINFO_EXTENSION); $targetExtension = pathinfo($target, PATHINFO_EXTENSION); diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index b07b6955b1a8b..c02d9b3a6b65f 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -14,6 +14,7 @@ use Icewind\Streams\IteratorDirectory; use OC\Files\Cache\Cache; use OC\Files\Cache\CacheEntry; +use OC\Files\Filesystem; use OC\Files\Storage\PolyFill\CopyDirectory; use OCP\Files\Cache\ICache; use OCP\Files\Cache\ICacheEntry; @@ -696,6 +697,7 @@ private function copyFile(ICacheEntry $sourceEntry, string $to) { throw new \Exception('Invalid source cache for object store copy'); } + Filesystem::getView()->disableCacheUpdate(); $targetId = $cache->copyFromCache($cache, $sourceEntry, $to); $targetUrn = $this->getURN($targetId);