diff options
author | Robin Appelman <robin@icewind.nl> | 2021-03-12 17:23:02 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2021-03-12 17:23:02 +0100 |
commit | d7748e2b4d80612936066e2e164b0af449240518 (patch) | |
tree | 3f2c630a1b56f57d3823241d88a38ff2777b482b /lib | |
parent | c2fc3195dd67d523db897ed04657a40f9b19cc8a (diff) | |
download | nextcloud-server-d7748e2b4d80612936066e2e164b0af449240518.tar.gz nextcloud-server-d7748e2b4d80612936066e2e164b0af449240518.zip |
verify that cache entry is valid
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Cache/Cache.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index e2301c3c7ac..fda8bc0972f 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) { |