diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-02-19 14:47:29 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-02-19 14:47:29 +0100 |
commit | 609a91a9b1bbee423a6bda2420dc4010b46757f6 (patch) | |
tree | 9def1e0df939d6015b2e4cbe4db5bcde9e907fbc /apps/files/js/files.js | |
parent | f9d4780d27ca21d86d8dacf73eda52a73a479d61 (diff) | |
download | nextcloud-server-609a91a9b1bbee423a6bda2420dc4010b46757f6.tar.gz nextcloud-server-609a91a9b1bbee423a6bda2420dc4010b46757f6.zip |
Show svg mime icons when no preview is available
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r-- | apps/files/js/files.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 1ec4c4ec7ab..dab060229e6 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -731,6 +731,9 @@ Files.getMimeIcon = function(mime, ready) { ready(Files.getMimeIcon.cache[mime]); } else { $.get( OC.filePath('files','ajax','mimeicon.php'), {mime: mime}, function(path) { + if(SVGSupport()){ + path = path.substr(0, path.length-4) + '.svg'; + } Files.getMimeIcon.cache[mime]=path; ready(Files.getMimeIcon.cache[mime]); }); @@ -785,8 +788,10 @@ Files.lazyLoadPreview = function(path, mime, ready, width, height, etag) { // this will make the browser cache the image var img = new Image(); img.onload = function(){ - //set preview thumbnail URL - ready(previewURL); + // if loading the preview image failed (no preview for the mimetype) then img.width will < 5 + if (img.width > 5) { + ready(previewURL); + } } img.src = previewURL; }); |