diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-02-12 14:24:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-12 14:24:17 +0100 |
commit | 4c21fc802f15793264dd4e10336af70cd7d823e3 (patch) | |
tree | d4770f80d15a51e4815884d12e8a6a2de9fa3f5d | |
parent | e47e1f6bddb9eb78217e5faf3e08f42abf4ca848 (diff) | |
parent | ad7c31914f080cdcec98dfadfb6e4d19416260dc (diff) | |
download | nextcloud-server-4c21fc802f15793264dd4e10336af70cd7d823e3.tar.gz nextcloud-server-4c21fc802f15793264dd4e10336af70cd7d823e3.zip |
Merge pull request #8309 from nextcloud/8308_13
[stable13] Show open graph preview in WhatsApp
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareController.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index c51bc1a75dd..3669d8fda46 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -385,7 +385,18 @@ class ShareController extends Controller { // We just have direct previews for image files if ($share->getNode()->getMimePart() === 'image') { $shareTmpl['previewURL'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.publicpreview.directLink', ['token' => $token]); + $ogPreview = $shareTmpl['previewURL']; + + //Whatapp is kind of picky about their size requirements + if ($this->request->isUserAgent(['/^WhatsApp/'])) { + $ogPreview = $this->urlGenerator->linkToRouteAbsolute('files_sharing.PublicPreview.getPreview', [ + 't' => $token, + 'x' => 256, + 'y' => 256, + 'a' => true, + ]); + } } } else { $shareTmpl['previewImage'] = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'favicon-fb.png')); |