summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2021-03-12 17:23:02 +0100
committerRobin Appelman <robin@icewind.nl>2021-03-12 17:23:02 +0100
commitd7748e2b4d80612936066e2e164b0af449240518 (patch)
tree3f2c630a1b56f57d3823241d88a38ff2777b482b /lib
parentc2fc3195dd67d523db897ed04657a40f9b19cc8a (diff)
downloadnextcloud-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.php3
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) {