From edd38e59481a98c56645a43ca6c9048fe1458d20 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 23 Sep 2013 10:26:46 +0200 Subject: [PATCH 1/2] fix previews in shared folders --- apps/files/lib/helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php index 08c807d7f7..1d431df04f 100644 --- a/apps/files/lib/helper.php +++ b/apps/files/lib/helper.php @@ -39,8 +39,8 @@ class Helper } if($file['isPreviewAvailable']) { - $relativePath = substr($file['path'], 6); - return \OC_Helper::previewIcon($relativePath); + $pathForPreview = $file['directory'] . '/' . $file['name']; + return \OC_Helper::previewIcon($pathForPreview); } return \OC_Helper::mimetypeIcon($file['mimetype']); } From 8a1618bce56a32e311626cd9f0e322dd7cf330c4 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 23 Sep 2013 12:27:05 +0200 Subject: [PATCH 2/2] implement previews for public upload --- apps/files/js/files.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 8ccb448abf..ec688eaf63 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -644,7 +644,11 @@ function lazyLoadPreview(path, mime, ready, width, height) { if ( ! height ) { height = $('#filestable').data('preview-y'); } - var previewURL = OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:width, y:height}); + if( $('#publicUploadButtonMock').length ) { + var previewURL = OC.Router.generate('core_ajax_public_preview', {file: encodeURIComponent(path), x:width, y:height, t:$('#dirToken').val()}); + } else { + var previewURL = OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:width, y:height}); + } $.get(previewURL, function() { previewURL = previewURL.replace('(', '%28'); previewURL = previewURL.replace(')', '%29');