summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-11-23 11:21:47 +0100
committerBackportbot <backportbot-noreply@rullzer.com>2018-11-29 15:34:03 +0000
commit863bf95d923b3d020498c04f841004d89567d261 (patch)
treec27b607f9bb4c85d80445f7548a43d63d7090149
parent9cfc9eb40c214bdd5d17c584ef7e1d1ac858b518 (diff)
downloadnextcloud-server-863bf95d923b3d020498c04f841004d89567d261.tar.gz
nextcloud-server-863bf95d923b3d020498c04f841004d89567d261.zip
Show mimetype icon if version preview is not available
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r--apps/files_versions/js/versionstabview.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/files_versions/js/versionstabview.js b/apps/files_versions/js/versionstabview.js
index a9470ad8393..12b493beec0 100644
--- a/apps/files_versions/js/versionstabview.js
+++ b/apps/files_versions/js/versionstabview.js
@@ -150,6 +150,12 @@
_formatItem: function(version) {
var timestamp = version.get('timestamp') * 1000;
var size = version.has('size') ? version.get('size') : 0;
+ var preview = OC.MimeType.getIconUrl(version.get('mimetype'));
+ var img = new Image();
+ img.onload = function () {
+ $('li[data-revision=' + version.get('timestamp') + '] .preview').attr('src', version.getPreviewUrl());
+ };
+ img.src = version.getPreviewUrl();
return _.extend({
versionId: version.get('id'),
@@ -163,7 +169,7 @@
downloadIconUrl: OC.imagePath('core', 'actions/download'),
downloadName: version.get('name'),
revertIconUrl: OC.imagePath('core', 'actions/history'),
- previewUrl: version.getPreviewUrl(),
+ previewUrl: preview,
revertLabel: t('files_versions', 'Restore'),
canRevert: (this.collection.getFileInfo().get('permissions') & OC.PERMISSION_UPDATE) !== 0
}, version.attributes);