diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 1f640ac5ff..a18fddcbde 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -1086,6 +1086,9 @@ class Cache implements ICache { * @return int fileid of copied entry */ public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int { + if ($sourceEntry->getId() < 0) { + throw new \RuntimeException("Invalid source cache entry on copyFromCache"); + } $data = $this->cacheEntryToArray($sourceEntry); $fileId = $this->put($targetPath, $data); if ($fileId <= 0) {