From 74ed0a8abaca4198e101c7c356677d47b93d35f0 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 20 Apr 2016 15:22:22 +0200 Subject: [PATCH] dont do optimized size propagation for encrypted files --- lib/private/files/cache/scanner.php | 7 +++++++ lib/private/files/cache/updater.php | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index c16e8515b0..8730707f1c 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -205,6 +205,10 @@ class Scanner extends BasicEmitter implements IScanner { $data['oldSize'] = 0; } + if (isset($cacheData['encrypted'])) { + $data['encrypted'] = $cacheData['encrypted']; + } + // post-emit only if it was a file. By that we avoid counting/treating folders as files if ($data['mimetype'] !== 'httpd/unix-directory') { $this->emit('\OC\Files\Cache\Scanner', 'postScanFile', array($file, $this->storageId)); @@ -222,6 +226,9 @@ class Scanner extends BasicEmitter implements IScanner { } } + if ($data && !isset($data['encrypted'])) { + $data['encrypted'] = false; + } return $data; } diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php index 80ba704883..3f80f2b616 100644 --- a/lib/private/files/cache/updater.php +++ b/lib/private/files/cache/updater.php @@ -118,7 +118,10 @@ class Updater implements IUpdater { } $data = $this->scanner->scan($path, Scanner::SCAN_SHALLOW, -1, false); - if (isset($data['oldSize']) && isset($data['size'])) { + if ( + isset($data['oldSize']) && isset($data['size']) && + !$data['encrypted'] // encryption is a pita and touches the cache itself + ) { $sizeDifference = $data['size'] - $data['oldSize']; } else { // scanner didn't provide size info, fallback to full size calculation