summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-01-16 21:47:08 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-01-24 11:24:18 +0100
commitcda811b6b49d2925fa044b5c391cea27a9da8724 (patch)
tree2021b9a476835da490667437669f24a76d763936 /apps/files
parent0224c61530c2942549c277dae4e7e54bf8ad2328 (diff)
downloadnextcloud-server-cda811b6b49d2925fa044b5c391cea27a9da8724.tar.gz
nextcloud-server-cda811b6b49d2925fa044b5c391cea27a9da8724.zip
Make filelist and sidebar use the fileid preview endpoint
This makes sure the preview is cached even after rename! yay! Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/js/filelist.js13
-rw-r--r--apps/files/js/sidebarpreviewmanager.js1
2 files changed, 13 insertions, 1 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index e50b402dea8..b46db792678 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1511,6 +1511,7 @@
// the typeof check ensures that the default value of animate is true
if (typeof(options.animate) === 'undefined' || !!options.animate) {
this.lazyLoadPreview({
+ fileId: fileData.id,
path: path + '/' + fileData.name,
mime: mime,
etag: fileData.etag,
@@ -1856,7 +1857,15 @@
urlSpec.x = Math.ceil(urlSpec.x);
urlSpec.y = Math.ceil(urlSpec.y);
urlSpec.forceIcon = 0;
- return OC.generateUrl('/core/preview.png?') + $.param(urlSpec);
+
+ if (typeof urlSpec.fileId !== 'undefined') {
+ delete urlSpec.file;
+ return OC.generateUrl('/core/preview?') + $.param(urlSpec);
+ } else {
+ delete urlSpec.fileId;
+ return OC.generateUrl('/core/preview.png?') + $.param(urlSpec);
+ }
+
},
/**
@@ -1869,6 +1878,7 @@
*/
lazyLoadPreview : function(options) {
var self = this;
+ var fileId = options.fileId;
var path = options.path;
var mime = options.mime;
var ready = options.callback;
@@ -1880,6 +1890,7 @@
urlSpec = {};
ready(iconURL); // set mimeicon URL
+ urlSpec.fileId = fileId;
urlSpec.file = OCA.Files.Files.fixPath(path);
if (options.x) {
urlSpec.x = options.x;
diff --git a/apps/files/js/sidebarpreviewmanager.js b/apps/files/js/sidebarpreviewmanager.js
index 2cf4248897a..27ccd4fc405 100644
--- a/apps/files/js/sidebarpreviewmanager.js
+++ b/apps/files/js/sidebarpreviewmanager.js
@@ -92,6 +92,7 @@
};
this._fileList.lazyLoadPreview({
+ fileId: model.get('id'),
path: model.getFullPath(),
mime: model.get('mimetype'),
etag: model.get('etag'),