diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 825146774536..d85d0d34599e 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1691,44 +1691,49 @@ urlSpec = {}; ready(iconURL); // set mimeicon URL - urlSpec.file = OCA.Files.Files.fixPath(path); - if (options.x) { - urlSpec.x = options.x; - } - if (options.y) { - urlSpec.y = options.y; - } - if (options.a) { - urlSpec.a = options.a; - } - if (options.mode) { - urlSpec.mode = options.mode; - } + var img = new Image(); - if (etag){ - // use etag as cache buster - urlSpec.c = etag; - } + if (oc_appconfig.core.previewsEnabled) { + urlSpec.file = OCA.Files.Files.fixPath(path); + if (options.x) { + urlSpec.x = options.x; + } + if (options.y) { + urlSpec.y = options.y; + } + if (options.a) { + urlSpec.a = options.a; + } + if (options.mode) { + urlSpec.mode = options.mode; + } - previewURL = self.generatePreviewUrl(urlSpec); - previewURL = previewURL.replace('(', '%28'); - previewURL = previewURL.replace(')', '%29'); + if (etag) { + // use etag as cache buster + urlSpec.c = etag; + } - // preload image to prevent delay - // this will make the browser cache the image - var img = new Image(); - img.onload = function(){ - // if loading the preview image failed (no preview for the mimetype) then img.width will < 5 - if (img.width > 5) { - ready(previewURL, img); - } else if (options.error) { - options.error(); + previewURL = self.generatePreviewUrl(urlSpec); + previewURL = previewURL.replace('(', '%28'); + previewURL = previewURL.replace(')', '%29'); + + // preload image to prevent delay + // this will make the browser cache the image + img.onload = function () { + // if loading the preview image failed (no preview for the mimetype) then img.width will < 5 + if (img.width > 5) { + ready(previewURL, img); + } else if (options.error) { + options.error(); + } + }; + if (options.error) { + img.onerror = options.error; } - }; - if (options.error) { - img.onerror = options.error; + img.src = previewURL; + } else { + ready(iconURL, img); } - img.src = previewURL; }, /** diff --git a/core/js/config.php b/core/js/config.php index dc84d1cf2bf2..ca0185dec7f5 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -154,7 +154,8 @@ ) ), "oc_appconfig" => json_encode( - array("core" => array( + [ + "core" => [ 'defaultExpireDateEnabled' => $defaultExpireDateEnabled, 'defaultExpireDate' => $defaultExpireDate, 'defaultExpireDateEnforced' => $enforceDefaultExpireDate, @@ -163,9 +164,10 @@ 'resharingAllowed' => \OCP\Share::isResharingAllowed(), 'remoteShareAllowed' => $outgoingServer2serverShareEnabled, 'federatedCloudShareDoc' => \OC::$server->getURLGenerator()->linkToDocs('user-sharing-federated'), - 'allowGroupSharing' => \OC::$server->getShareManager()->allowGroupSharing() - ) - ) + 'allowGroupSharing' => \OC::$server->getShareManager()->allowGroupSharing(), + 'previewsEnabled' => \OC::$server->getConfig()->getSystemValue('enable_previews', true) === true, + ] + ] ), "oc_defaults" => json_encode( array(