summaryrefslogtreecommitdiffstats
path: root/core/js/oc-dialogs.js
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-10-14 17:29:36 +0200
committerRobin Appelman <robin@icewind.nl>2016-10-14 17:32:23 +0200
commit8d093e976acd818311e3be97b0d9afd6631632f2 (patch)
tree5918e9f9435107ffaf2b73fbc3e584811a5f3c6f /core/js/oc-dialogs.js
parent53eb0f7f42fc324fa15fee87ff673f7e358a4fce (diff)
downloadnextcloud-server-8d093e976acd818311e3be97b0d9afd6631632f2.tar.gz
nextcloud-server-8d093e976acd818311e3be97b0d9afd6631632f2.zip
use mimetype icons in filepicker if there is no preview
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'core/js/oc-dialogs.js')
-rw-r--r--core/js/oc-dialogs.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index bdee8a1bb09..edc0b3c797a 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -769,10 +769,17 @@ var OCdialogs = {
});
if (entry.type === 'file') {
var urlSpec = {
- file: dir + '/' + entry.name
+ file: dir + '/' + entry.name,
};
+ $li.find('img').attr('src', OC.MimeType.getIconUrl(entry.mimetype));
+ var img = new Image();
var previewUrl = OC.generateUrl('/core/preview.png?') + $.param(urlSpec);
- $li.find('img').attr('src', previewUrl);
+ img.onload = function() {
+ if (img.width > 5) {
+ $li.find('img').attr('src', previewUrl);
+ }
+ };
+ img.src = previewUrl;
}
else {
$li.find('img').attr('src', OC.Util.replaceSVGIcon(entry.icon));