aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/share/file.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/lib/share/file.php')
-rw-r--r--apps/files_sharing/lib/share/file.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php
index c956c55a1df..ec0f368386f 100644
--- a/apps/files_sharing/lib/share/file.php
+++ b/apps/files_sharing/lib/share/file.php
@@ -91,10 +91,17 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
$file['name'] = basename($item['file_target']);
$file['mimetype'] = $item['mimetype'];
$file['mimepart'] = $item['mimepart'];
- $file['size'] = $item['size'];
$file['mtime'] = $item['mtime'];
$file['encrypted'] = $item['encrypted'];
$file['etag'] = $item['etag'];
+ $storage = \OC\Files\Filesystem::getStorage('/');
+ $cache = $storage->getCache();
+ if ($item['encrypted'] or ($item['unencrypted_size'] > 0 and $cache->getMimetype($item['mimetype']) === 'httpd/unix-directory')) {
+ $file['size'] = $item['unencrypted_size'];
+ $file['encrypted_size'] = $item['size'];
+ } else {
+ $file['size'] = $item['size'];
+ }
$files[] = $file;
}
return $files;