aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/public.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/public.php')
-rw-r--r--apps/files_sharing/public.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index ec6b4e815f8..ae3e27cab3f 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -19,6 +19,20 @@ function fileCmp($a, $b) {
}
}
+function determineIcon($file, $sharingRoot, $sharingToken) {
+ // for folders we simply reuse the files logic
+ if($file['type'] == 'dir') {
+ return \OCA\files\lib\Helper::determineIcon($file);
+ }
+
+ $relativePath = substr($file['path'], 6);
+ $relativePath = substr($relativePath, strlen($sharingRoot));
+ if($file['isPreviewAvailable']) {
+ return OCP\publicPreview_icon($relativePath, $sharingToken);
+ }
+ return OCP\mimetype_icon($file['mimetype']);
+}
+
if (isset($_GET['t'])) {
$token = $_GET['t'];
$linkItem = OCP\Share::getShareByToken($token);
@@ -176,6 +190,7 @@ if (isset($path)) {
}
$i['directory'] = $getPath;
$i['permissions'] = OCP\PERMISSION_READ;
+ $i['icon'] = determineIcon($i, $basePath, $token);
$files[] = $i;
}
usort($files, "fileCmp");