Fix part file partial cache logic in encryption code

The encryption code uses partial cache entries for the part file (which
are not stored in the database) but are useful for other parts of the
code to retrieve the file size again.

This means that in the fixed code $info was empty, so getData() could
not be called.

The fix makes sure to support both cases when the cache entry exists and
doesn't.
This commit is contained in:
Vincent Petry 2016-02-08 20:57:20 +01:00 committed by Lukas Reschke
parent 98497aa423
commit 19980be116

View file

@ -129,9 +129,15 @@ class Encryption extends Wrapper {
if (isset($this->unencryptedSize[$fullPath])) {
$size = $this->unencryptedSize[$fullPath];
// update file cache
if ($info) {
$info = $info->getData();
} else {
$info = [];
}
$info['encrypted'] = true;
$info['size'] = $size;
$this->getCache()->put($path, $info->getData());
$this->getCache()->put($path, $info);
return $size;
}