Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
use mimetype icons in filepicker if there is no preview
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Oct 14, 2016
commit 8d093e976acd818311e3be97b0d9afd6631632f2
11 changes: 9 additions & 2 deletions core/js/oc-dialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down