diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 70bdcfec2422..ad6c24554f27 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1734,44 +1734,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 0afe8e98336e..7ebd84d1fd2d 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -157,7 +157,8 @@ ] ), "oc_appconfig" => json_encode( - ["core" => [ + [ + "core" => [ 'defaultExpireDateEnabled' => $defaultExpireDateEnabled, 'defaultExpireDate' => $defaultExpireDate, 'defaultExpireDateEnforced' => $enforceDefaultExpireDate, @@ -167,9 +168,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( [