diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-09-12 21:43:35 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-09-12 21:43:35 +0200 |
commit | c9d26631592ba58d8026a14e7f637cfe835fa15d (patch) | |
tree | b6bc91006e0207a2e2b26ba5d1205853e0ca7fda /apps/files_sharing/public.php | |
parent | b9167196fb331d7197210e4a130e03d32d839b8a (diff) | |
parent | c7ca86799b2608609ead7ecd2d84d0bbd47c6548 (diff) | |
download | nextcloud-server-c9d26631592ba58d8026a14e7f637cfe835fa15d.tar.gz nextcloud-server-c9d26631592ba58d8026a14e7f637cfe835fa15d.zip |
Merge branch 'master' into fileapi-foreward
Diffstat (limited to 'apps/files_sharing/public.php')
-rw-r--r-- | apps/files_sharing/public.php | 15 |
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"); |