From 4077f684e137774f48cb1f575bc8a7bfd862c78b Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 25 Sep 2017 21:47:09 +0200 Subject: [PATCH] Only have direct preview urls for image files Signed-off-by: Roeland Jago Douma --- apps/files_sharing/lib/Controller/ShareController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index ec345c4e98..a7cf1a7897 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -372,13 +372,16 @@ class ShareController extends Controller { $shareTmpl['previewMaxX'] = $this->config->getSystemValue('preview_max_x', 1024); $shareTmpl['previewMaxY'] = $this->config->getSystemValue('preview_max_y', 1024); $shareTmpl['disclaimer'] = $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null); + $shareTmpl['previewURL'] = $shareTmpl['downloadURL']; if ($shareTmpl['previewSupported']) { $shareTmpl['previewImage'] = $this->urlGenerator->linkToRouteAbsolute( 'files_sharing.PublicPreview.getPreview', ['x' => 200, 'y' => 200, 'file' => $shareTmpl['directory_path'], 't' => $shareTmpl['dirToken']]); - $shareTmpl['previewURL'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.publicpreview.directLink', ['token' => $token]); + // We just have direct previews for image files + if ($share->getNode()->getMimePart() === 'image') { + $shareTmpl['previewURL'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.publicpreview.directLink', ['token' => $token]); + } } else { $shareTmpl['previewImage'] = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'favicon-fb.png')); - $shareTmpl['previewURL'] = $shareTmpl['downloadURL']; } // Load files we need