aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/lib/util.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_encryption/lib/util.php')
-rw-r--r--apps/files_encryption/lib/util.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 3922f7d9d7f..5d7858569f3 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -508,10 +508,11 @@ class Util {
// get the size from filesystem
$fullPath = $this->view->getLocalFile($path);
- $size = filesize($fullPath);
+ $size = $this->view->filesize($path);
// calculate last chunk nr
$lastChunkNr = floor($size / 8192);
+ $lastChunkSize = $size - ($lastChunkNr * 8192);
// open stream
$stream = fopen('crypt://' . $path, "r");
@@ -524,7 +525,7 @@ class Util {
fseek($stream, $lastChunckPos);
// get the content of the last chunk
- $lastChunkContent = fread($stream, 8192);
+ $lastChunkContent = fread($stream, $lastChunkSize);
// calc the real file size with the size of the last chunk
$realSize = (($lastChunkNr * 6126) + strlen($lastChunkContent));