]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix download link included in public share page with hidden download 16125/head
authorDaniel Calviño Sánchez <danxuliu@gmail.com>
Thu, 27 Jun 2019 10:14:27 +0000 (12:14 +0200)
committerBackportbot <backportbot-noreply@rullzer.com>
Thu, 27 Jun 2019 14:29:45 +0000 (14:29 +0000)
The preview element in the public share page was always wrapped with a
link to download the file; now that link is included only if the "Hide
download" option of the share is not enabled.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
apps/files_sharing/js/public.js

index d339ae1dcb4e1c61684a5a2adf2e3597f2bdee98..e4a6bbd3ed1d29ecb48dc781c85c11be2a1a2883 100644 (file)
@@ -136,9 +136,11 @@ OCA.Sharing.PublicApp = {
                        scalingup: 0
                };
 
-               var imgcontainer = $('<a href="' + $('#previewURL').val()
-                       + '" target="_blank"><img class="publicpreview" alt=""></a>');
-               var img = imgcontainer.find('.publicpreview');
+               var imgcontainer = $('<img class="publicpreview" alt="">');
+               if (hideDownload === 'false') {
+                       imgcontainer = $('<a href="' + $('#previewURL').val() + '" target="_blank"></a>').append(imgcontainer);
+               }
+               var img = imgcontainer.hasClass('publicpreview')? imgcontainer: imgcontainer.find('.publicpreview');
                img.css({
                        'max-width': previewWidth,
                        'max-height': previewHeight