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>
This commit is contained in:
Roeland Jago Douma 2018-01-16 21:47:08 +01:00
parent 0224c61530
commit cda811b6b4
No known key found for this signature in database
GPG Key ID: F941078878347C0C
2 changed files with 13 additions and 1 deletions

View File

@ -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;

View File

@ -92,6 +92,7 @@
};
this._fileList.lazyLoadPreview({
fileId: model.get('id'),
path: model.getFullPath(),
mime: model.get('mimetype'),
etag: model.get('etag'),