Merge pull request #16013 from nextcloud/versions-preview-string-id

fix previews of versions with non numeric version ids
This commit is contained in:
Roeland Jago Douma 2019-06-25 21:21:50 +02:00 committed by GitHub
commit 11b71a143e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 4 additions and 4 deletions

View file

@ -1,4 +1,4 @@
<li data-revision="{{timestamp}}"> <li data-revision="{{id}}">
<div> <div>
<div class="preview-container"> <div class="preview-container">
<img class="preview" src="{{previewUrl}}" width="44" height="44"/> <img class="preview" src="{{previewUrl}}" width="44" height="44"/>

View file

@ -68,7 +68,7 @@
version.fileId = fileId; version.fileId = fileId;
version.name = name; version.name = name;
version.timestamp = parseInt(moment(new Date(version.timestamp)).format('X'), 10); version.timestamp = parseInt(moment(new Date(version.timestamp)).format('X'), 10);
version.id = parseInt(OC.basename(version.href), 10); version.id = OC.basename(version.href);
version.size = parseInt(version.size, 10); version.size = parseInt(version.size, 10);
version.user = user; version.user = user;
version.client = client; version.client = client;

View file

@ -55,7 +55,7 @@
var url = OC.generateUrl('/apps/files_versions/preview'); var url = OC.generateUrl('/apps/files_versions/preview');
var params = { var params = {
file: this.get('fullPath'), file: this.get('fullPath'),
version: this.get('timestamp') version: this.get('id')
}; };
return url + '?' + OC.buildQueryString(params); return url + '?' + OC.buildQueryString(params);
}, },

View file

@ -156,7 +156,7 @@ import Template from './templates/template.handlebars';
var preview = OC.MimeType.getIconUrl(version.get('mimetype')); var preview = OC.MimeType.getIconUrl(version.get('mimetype'));
var img = new Image(); var img = new Image();
img.onload = function () { img.onload = function () {
$('li[data-revision=' + version.get('timestamp') + '] .preview').attr('src', version.getPreviewUrl()); $('li[data-revision=' + version.get('id') + '] .preview').attr('src', version.getPreviewUrl());
}; };
img.src = version.getPreviewUrl(); img.src = version.getPreviewUrl();