fix unencrypted_size for files when scanning

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/36857/head
Robin Appelman 3 years ago
parent 63fb33538c
commit 649bed5154
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
  1. 8
      lib/private/Files/Cache/Scanner.php
  2. 5
      lib/private/Files/Storage/Wrapper/Encryption.php

@ -208,9 +208,17 @@ class Scanner extends BasicEmitter implements IScanner {
$data['etag'] = $etag;
}
}
// we only updated unencrypted_size if it's already set
if ($cacheData['unencrypted_size'] === 0) {
unset($data['unencrypted_size']);
}
// Only update metadata that has changed
$newData = array_diff_assoc($data, $cacheData->getData());
} else {
// we only updated unencrypted_size if it's already set
unset($data['unencrypted_size']);
$newData = $data;
$fileId = -1;
}

@ -180,10 +180,12 @@ class Encryption extends Wrapper {
if (isset($this->unencryptedSize[$fullPath])) {
$data['encrypted'] = true;
$data['size'] = $this->unencryptedSize[$fullPath];
$data['unencrypted_size'] = $data['size'];
} else {
if (isset($info['fileid']) && $info['encrypted']) {
$data['size'] = $this->verifyUnencryptedSize($path, $info->getUnencryptedSize());
$data['encrypted'] = true;
$data['unencrypted_size'] = $data['size'];
}
}
@ -494,7 +496,8 @@ class Encryption extends Wrapper {
$result = $unencryptedSize;
if ($unencryptedSize < 0 ||
($size > 0 && $unencryptedSize === $size)
($size > 0 && $unencryptedSize === $size) ||
$unencryptedSize > $size
) {
// check if we already calculate the unencrypted size for the
// given path to avoid recursions

Loading…
Cancel
Save