Skip to content

Commit

Permalink
debug: Fix copy in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Oct 21, 2024
1 parent d050233 commit fbc54a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/private/Files/Cache/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions lib/private/Files/ObjectStore/ObjectStoreStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit fbc54a6

Please sign in to comment.