diff options
author | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2013-09-12 07:48:00 -0700 |
---|---|---|
committer | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2013-09-12 07:48:00 -0700 |
commit | c7ca86799b2608609ead7ecd2d84d0bbd47c6548 (patch) | |
tree | 2c6ad385dba6a944bf396dbb69e32d4fb7074c7e /apps/files_sharing | |
parent | b7205d97d7797daf057d47a5a07d2bad3b0db4da (diff) | |
parent | 9d661eab23f9ba284e4a5060b5de5d868b330d45 (diff) | |
download | nextcloud-server-c7ca86799b2608609ead7ecd2d84d0bbd47c6548.tar.gz nextcloud-server-c7ca86799b2608609ead7ecd2d84d0bbd47c6548.zip |
Merge pull request #4816 from owncloud/fixing-723-master
Fixing 723 master
Diffstat (limited to 'apps/files_sharing')
-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"); |