summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-09-23 06:31:50 -0700
committerThomas Müller <thomas.mueller@tmit.eu>2013-09-23 06:31:50 -0700
commit46f64cc39a32494d2b83fecb2acbe265d3f77271 (patch)
tree4d5c51204ff40d7d9478c8785afb734038f64b1f
parent437858852c039ba7fef7e6cf2a4a2e9dae68c1a2 (diff)
parent8a1618bce56a32e311626cd9f0e322dd7cf330c4 (diff)
downloadnextcloud-server-46f64cc39a32494d2b83fecb2acbe265d3f77271.tar.gz
nextcloud-server-46f64cc39a32494d2b83fecb2acbe265d3f77271.zip
Merge pull request #4950 from owncloud/fix_preview_shared_folder
Fix preview for shared folder and public upload
-rw-r--r--apps/files/js/files.js6
-rw-r--r--apps/files/lib/helper.php4
2 files changed, 7 insertions, 3 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 8ccb448abfb..ec688eaf63e 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');
diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php
index 08c807d7f7b..1d431df04f1 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']);
}