X-Git-Url: https://git.p6c8.net/jirafeau.git/blobdiff_plain/32842e276eaf9f2fcd310c476828c53ae90beed3..6d6c111b80ad13201b7acd7c2f5b8fd6d160e11b:/lib/functions.js.php diff --git a/lib/functions.js.php b/lib/functions.js.php index 71ce17b..14fad1d 100644 --- a/lib/functions.js.php +++ b/lib/functions.js.php @@ -182,16 +182,17 @@ function show_link (reference, delete_code, crypt_key, date) } // Test if content can be previewed - type = document.getElementById('file_select').files[0].type; - if (type.indexOf("image") > -1 || - type.indexOf("audio") > -1 || - type.indexOf("text") > -1 || - type.indexOf("video") > -1) - { + type = document.getElementById('file_select').files[0].type; + if ((type.startsWith('image/') + || type.startsWith('audio') + || type.startsWith('text/plain') + || type.startsWith('video/')) + && !type.includes('image/svg+xml')) + { document.getElementById('preview_link').href = preview_link_href; document.getElementById('preview_link_text').innerHTML = web_root + preview_link_href; document.getElementById('upload_finished_preview').style.display = ''; - } + } } // Direct download link