aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2024-10-21 15:42:47 +0200
committerLouis Chemineau <louis@chmn.me>2024-10-21 15:42:47 +0200
commitfbc54a6c9ca0512c088d92b447b3cec81dac2018 (patch)
treefe7c5d51d234975396f8ff915ef9d2c3626b25ec
parentd050233767a4ba4da4b70c3a43bf3d0551b1cf27 (diff)
downloadnextcloud-server-artonge/fix/copy_cache_during_copy_operations.tar.gz
nextcloud-server-artonge/fix/copy_cache_during_copy_operations.zip
Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r--lib/private/Files/Cache/Updater.php11
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php2
2 files changed, 4 insertions, 9 deletions
diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php
index ee320950af4..3f619ccba10 100644
--- a/lib/private/Files/Cache/Updater.php
+++ b/lib/private/Files/Cache/Updater.php
@@ -202,17 +202,10 @@ class Updater implements IUpdater {
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 b07b6955b1a..c02d9b3a6b6 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -14,6 +14,7 @@ use Icewind\Streams\CountWrapper;
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 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
throw new \Exception('Invalid source cache for object store copy');
}
+ Filesystem::getView()->disableCacheUpdate();
$targetId = $cache->copyFromCache($cache, $sourceEntry, $to);
$targetUrn = $this->getURN($targetId);