summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-05-24 13:49:02 +0200
committerVincent Petry <pvince81@owncloud.com>2016-05-24 13:49:02 +0200
commit465cf9fe9b8fb8c448cb42d4c811b2ecd215d4f1 (patch)
tree83b68a95fb5a3eeb36eb6e00f9b99e6db979c91d
parent4ffc936624d7a26271862a794fd472b1678de644 (diff)
parentdf59c5d1ee5810293e3c7a6a63f00f0e94126c03 (diff)
downloadnextcloud-server-465cf9fe9b8fb8c448cb42d4c811b2ecd215d4f1.tar.gz
nextcloud-server-465cf9fe9b8fb8c448cb42d4c811b2ecd215d4f1.zip
Merge pull request #24346 from lenz1111/fix_24331
Fix: Bugs in shared link with video #24331
-rw-r--r--apps/files_sharing/js/public.js5
-rw-r--r--apps/files_sharing/lib/controllers/sharecontroller.php2
-rw-r--r--apps/files_sharing/templates/public.php6
3 files changed, 8 insertions, 5 deletions
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index 2d93bc17996..572ccc47b71 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -139,7 +139,7 @@ OCA.Sharing.PublicApp = {
}).then(function (data) {
self._showTextPreview(data, previewHeight);
});
- } else if (previewSupported === 'true' ||
+ } else if ((previewSupported === 'true' && mimetype.substr(0, mimetype.indexOf('/')) !== 'video') ||
mimetype.substr(0, mimetype.indexOf('/')) === 'image' &&
mimetype !== 'image/svg+xml') {
img.attr('src', OC.filePath('files_sharing', 'ajax', 'publicpreview.php') + '?' + OC.buildQueryString(params));
@@ -149,6 +149,9 @@ OCA.Sharing.PublicApp = {
img.attr('width', 128);
img.appendTo('#imgframe');
}
+ else if (previewSupported === 'true') {
+ $('#imgframe > video').attr('poster', OC.filePath('files_sharing', 'ajax', 'publicpreview.php') + '?' + OC.buildQueryString(params));
+ }
if (this.fileList) {
// TODO: move this to a separate PublicFileList class that extends OCA.Files.FileList (+ unit tests)
diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php
index 8662765d196..04912d20afc 100644
--- a/apps/files_sharing/lib/controllers/sharecontroller.php
+++ b/apps/files_sharing/lib/controllers/sharecontroller.php
@@ -347,6 +347,8 @@ class ShareController extends Controller {
$shareTmpl['downloadURL'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.downloadShare', array('token' => $token));
$shareTmpl['maxSizeAnimateGif'] = $this->config->getSystemValue('max_filesize_animated_gifs_public_sharing', 10);
$shareTmpl['previewEnabled'] = $this->config->getSystemValue('enable_previews', true);
+ $shareTmpl['previewMaxX'] = $this->config->getSystemValue('preview_max_x', 1024);
+ $shareTmpl['previewMaxY'] = $this->config->getSystemValue('preview_max_y', 1024);
$csp = new OCP\AppFramework\Http\ContentSecurityPolicy();
$csp->addAllowedFrameDomain('\'self\'');
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index cb7fe1103b5..e39d1b08076 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -20,12 +20,10 @@ OCP\Util::addScript('files', 'newfilemenu');
OCP\Util::addScript('files', 'files');
OCP\Util::addScript('files', 'filelist');
OCP\Util::addscript('files', 'keyboardshortcuts');
-
-$thumbSize = 1024;
?>
<?php if ($_['previewSupported']): /* This enables preview images for links (e.g. on Facebook, Google+, ...)*/?>
- <link rel="image_src" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute( 'core_ajax_public_preview', array('x' => $thumbSize, 'y' => $thumbSize, 'file' => $_['directory_path'], 't' => $_['dirToken']))); ?>" />
+ <link rel="image_src" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute( 'core_ajax_public_preview', array('x' => $_['previewMaxX'], 'y' => $_['previewMaxY'], 'file' => $_['directory_path'], 't' => $_['dirToken']))); ?>" />
<?php endif; ?>
<div id="notification-container">
@@ -94,7 +92,7 @@ $thumbSize = 1024;
<?php else: ?>
<?php if ($_['previewEnabled'] && substr($_['mimetype'], 0, strpos($_['mimetype'], '/')) == 'video'): ?>
<div id="imgframe">
- <video tabindex="0" controls="" preload="none">
+ <video tabindex="0" controls="" preload="none" style="max-width: <?php p($_['previewMaxX']); ?>px; max-height: <?php p($_['previewMaxY']); ?>px">
<source src="<?php p($_['downloadURL']); ?>" type="<?php p($_['mimetype']); ?>" />
</video>
</div>