diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-10-31 21:00:36 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-10-31 21:00:36 +0100 |
commit | 2e443c97afa0aae91483a3bb89e88d78d837be11 (patch) | |
tree | 3ff4f5ab9b5927378204618dd1e8de7bedda9061 /apps/files_sharing | |
parent | 22ef95ca696e856db8288c294db3580e364106c1 (diff) | |
download | nextcloud-server-2e443c97afa0aae91483a3bb89e88d78d837be11.tar.gz nextcloud-server-2e443c97afa0aae91483a3bb89e88d78d837be11.zip |
Use the new direct endpoint for the og:image
Some providers had issues when using the preview link (since it was
double encoded).
Now we actually serve the max size preview so it looks better
The image isn't cropped anymore so supporting platforms can just embed
the whole image.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareController.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index 700ac220804..9c3f4c6afeb 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -373,15 +373,20 @@ class ShareController extends Controller { $shareTmpl['previewMaxY'] = $this->config->getSystemValue('preview_max_y', 1024); $shareTmpl['disclaimer'] = $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null); $shareTmpl['previewURL'] = $shareTmpl['downloadURL']; + $ogPreview = ''; if ($shareTmpl['previewSupported']) { $shareTmpl['previewImage'] = $this->urlGenerator->linkToRouteAbsolute( 'files_sharing.PublicPreview.getPreview', ['x' => 200, 'y' => 200, 'file' => $shareTmpl['directory_path'], 't' => $shareTmpl['dirToken']]); + $ogPreview = $shareTmpl['previewImage']; + // 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']; } } else { $shareTmpl['previewImage'] = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'favicon-fb.png')); + $ogPreview = $shareTmpl['previewImage']; } // Load files we need @@ -411,7 +416,7 @@ class ShareController extends Controller { \OCP\Util::addHeader('meta', ['property' => "og:site_name", 'content' => $this->defaults->getName()]); \OCP\Util::addHeader('meta', ['property' => "og:url", 'content' => $shareTmpl['shareUrl']]); \OCP\Util::addHeader('meta', ['property' => "og:type", 'content' => "object"]); - \OCP\Util::addHeader('meta', ['property' => "og:image", 'content' => $shareTmpl['previewImage']]); + \OCP\Util::addHeader('meta', ['property' => "og:image", 'content' => $ogPreview]); $this->eventDispatcher->dispatch('OCA\Files_Sharing::loadAdditionalScripts'); |