]> git.sesse.net Git - vlc/commitdiff
Web Interface: correctly select extensions
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 31 Mar 2012 20:53:17 +0000 (22:53 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 31 Mar 2012 20:54:28 +0000 (22:54 +0200)
Close #6544

share/lua/http/js/controlers.js

index 805f3bb11d653f4118a3d15f1d8cc262dd3839c9..e9a606746fd1e959f2bfbdfb86f8d7ff138b0091 100644 (file)
@@ -166,8 +166,9 @@ function browse(dir) {
             var tgt = browse_target.indexOf('__') == -1 ? browse_target : browse_target.substr(0, browse_target.indexOf('__'));
             $('#browse_elements').empty();
             $('element', data).each(function () {
-                if ($(this).attr('type') == 'dir' || $.inArray($(this).attr('name').substr(-3), video_types) != -1 || $.inArray($(this).attr('name').substr(-3), audio_types) != -1) {
-                    $('#browse_elements').append(createElementLi($(this).attr('name'), $(this).attr('type'), $(this).attr('uri'), $(this).attr('name').substr(-3)));
+                var ext = $(this).attr('name').substr($(this).attr('name').lastIndexOf('.') + 1);
+                if ($(this).attr('type') == 'dir' || $.inArray(ext, video_types) != -1 || $.inArray(ext, audio_types) != -1) {
+                    $('#browse_elements').append(createElementLi($(this).attr('name'), $(this).attr('type'), $(this).attr('uri'), ext));
                 }
             });
             $('[opendir]').dblclick(function () {