X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/blobdiff_plain/8665ea5fc150ca65125f24023b545fe39bdb2a95..03f216f58de659215008347947a754096902771e:/lib/functions.js.php diff --git a/lib/functions.js.php b/lib/functions.js.php index 71ce17b..7cf1da8 100644 --- a/lib/functions.js.php +++ b/lib/functions.js.php @@ -183,10 +183,10 @@ 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) + if (type.startsWith('image/') || + type.startsWith('audio') || + type.startsWith('text/plain') || + type.startsWith('video/')) { document.getElementById('preview_link').href = preview_link_href; document.getElementById('preview_link_text').innerHTML = web_root + preview_link_href;