From 84b8cb12be60b2d513f31181792d4c0ff35a827d Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 1 Nov 2017 14:49:52 +0100 Subject: Clicking publicly shared image opens direct preview url Signed-off-by: Jan-Christoph Borchardt --- apps/files_sharing/js/public.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'apps/files_sharing/js/public.js') diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 17dbdcd2696..2581f77c63f 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -116,7 +116,8 @@ OCA.Sharing.PublicApp = { scalingup: 0 }; - var img = $(''); + var imgcontainer = $(''); + var img = imgcontainer.find('.publicpreview'); img.css({ 'max-width': previewWidth, 'max-height': previewHeight @@ -128,7 +129,7 @@ OCA.Sharing.PublicApp = { if (mimetype === 'image/gif' && (maxGifSize === -1 || fileSize <= (maxGifSize * 1024 * 1024))) { img.attr('src', $('#downloadURL').val()); - img.appendTo('#imgframe'); + imgcontainer.appendTo('#imgframe'); } else if (mimetype.substr(0, mimetype.indexOf('/')) === 'text' && window.btoa) { // Undocumented Url to public WebDAV endpoint var url = parent.location.protocol + '//' + location.host + OC.linkTo('', 'public.php/webdav'); @@ -145,11 +146,11 @@ OCA.Sharing.PublicApp = { mimetype.substr(0, mimetype.indexOf('/')) === 'image' && mimetype !== 'image/svg+xml') { img.attr('src', OC.filePath('files_sharing', 'ajax', 'publicpreview.php') + '?' + OC.buildQueryString(params)); - img.appendTo('#imgframe'); + imgcontainer.appendTo('#imgframe'); } else if (mimetype.substr(0, mimetype.indexOf('/')) !== 'video') { img.attr('src', OC.Util.replaceSVGIcon(mimetypeIcon)); img.attr('width', 128); - img.appendTo('#imgframe'); + imgcontainer.appendTo('#imgframe'); } else if (previewSupported === 'true') { $('#imgframe > video').attr('poster', OC.filePath('files_sharing', 'ajax', 'publicpreview.php') + '?' + OC.buildQueryString(params)); -- cgit v1.2.3