]> git.p6c8.net - jirafeau.git/blobdiff - lib/functions.js.php
[BUGFIX] fix file previewing
[jirafeau.git] / lib / functions.js.php
index 71ce17ba0dafdc18a92ae8a022d98677f9f7d6f8..7cf1da8644261a52476a3fcfc880fc33efdac3cb 100644 (file)
@@ -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;
 
         // 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;
          {
             document.getElementById('preview_link').href = preview_link_href;
             document.getElementById('preview_link_text').innerHTML = web_root + preview_link_href;

patrick-canterino.de