mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix unencrypted_size for files when scanning
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
63fb33538c
commit
649bed5154
2 changed files with 12 additions and 1 deletions
|
|
@ -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…
Reference in a new issue