aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-10-22 10:54:01 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-10-30 15:18:55 +0100
commitbfb2a914d26ed05db871e961b66c3eddd5463de7 (patch)
tree9b0506e89a6d5290e597d24f21db2d897fe39da5 /apps/files_sharing/lib
parentc237a3f00340d807590f5b4df8e69738ed2fa2b9 (diff)
downloadnextcloud-server-bfb2a914d26ed05db871e961b66c3eddd5463de7.tar.gz
nextcloud-server-bfb2a914d26ed05db871e961b66c3eddd5463de7.zip
Honour "hide download" in the public share page
When the "hide download" property of a share is set the public share page will not show the download button nor the menu with the download, direct link and "Add to your Nextcloud" actions; the "downloadURL" hidden field will not be included either in the generated HTML. Despite that, note that the "downloadURL" parameter is still set and passed to the template, as this could be needed anyway to generate previews (for example, of audio files). Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/Controller/ShareController.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php
index 15f5a2e2e60..1a92000a5f6 100644
--- a/apps/files_sharing/lib/Controller/ShareController.php
+++ b/apps/files_sharing/lib/Controller/ShareController.php
@@ -445,12 +445,14 @@ class ShareController extends AuthPublicShareController {
$response = new PublicTemplateResponse($this->appName, 'public', $shareTmpl);
$response->setHeaderTitle($shareTmpl['filename']);
$response->setHeaderDetails($this->l10n->t('shared by %s', [$shareTmpl['displayName']]));
- $response->setHeaderActions([
- new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download-white', $shareTmpl['downloadURL'], 0),
- new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download', $shareTmpl['downloadURL'], 10, $shareTmpl['fileSize']),
- new LinkMenuAction($this->l10n->t('Direct link'), 'icon-public', $shareTmpl['previewURL']),
- new ExternalShareMenuAction($this->l10n->t('Add to your Nextcloud'), 'icon-external', $shareTmpl['owner'], $shareTmpl['displayName'], $shareTmpl['filename']),
- ]);
+ if (!$share->getHideDownload()) {
+ $response->setHeaderActions([
+ new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download-white', $shareTmpl['downloadURL'], 0),
+ new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download', $shareTmpl['downloadURL'], 10, $shareTmpl['fileSize']),
+ new LinkMenuAction($this->l10n->t('Direct link'), 'icon-public', $shareTmpl['previewURL']),
+ new ExternalShareMenuAction($this->l10n->t('Add to your Nextcloud'), 'icon-external', $shareTmpl['owner'], $shareTmpl['displayName'], $shareTmpl['filename']),
+ ]);
+ }
$response->setContentSecurityPolicy($csp);