Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-02-12 13:09:08 +0300
committerGitHub <noreply@github.com>2018-02-12 13:09:08 +0300
commit4bd14ef3081fadce717e6b50d31fbb750962cabf (patch)
tree8ae56ce0f29352a0cd2f2146fbc93ebf028bd4d1 /apps
parent825975b3228ec67e41c4400c473e3b169ce245b9 (diff)
parent20844c828a4ec8c42773fe61ec9127567044a24a (diff)
Merge pull request #8308 from nextcloud/public_link_wa_preview
Show open graph preview in WhatsApp
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/Controller/ShareController.php11
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 eff6cf65142..b5b2979ec6b 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'));