]> git.sesse.net Git - vlc/commitdiff
web intf: fix uri decoding when browsing.
authorFrancois Cartegnie <fcvlcdev@free.fr>
Fri, 21 Oct 2011 18:39:15 +0000 (20:39 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Fri, 21 Oct 2011 20:04:16 +0000 (22:04 +0200)
And now make use of URI

share/lua/http/js/controlers.js
share/lua/intf/modules/httprequests.lua

index fb21dd531d76724eab5b363fc9ad7ba9ad905bef..43d70dadd73b014ac559f755322e36ec030deca0 100644 (file)
@@ -163,16 +163,16 @@ function sendCommand(params,append){
        }
 }
 function browse(dir){
-       dir     =       dir==undefined ? '~' : dir;
+       dir     =       dir==undefined ? 'file://~' : dir;
        $.ajax({
                url: 'requests/browse.xml',
-               data:'dir='+encodeURIComponent(dir),
+               data:'uri='+encodeURIComponent(dir),
                success: function(data,status,jqXHR){
                        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('path'),$(this).attr('name').substr(-3)));
+                                       $('#browse_elements').append(createElementLi($(this).attr('name'),$(this).attr('type'),$(this).attr('uri'),$(this).attr('name').substr(-3)));
                                }
                        });
                        $('[opendir]').dblclick(function(){
@@ -195,7 +195,7 @@ function browse(dir){
                                        case '#mobile':
                                                break;
                                        default:
-                                               sendCommand('command=in_play&input=file://'+encodeURIComponent($(this).attr('openfile')));
+                                               sendCommand('command=in_play&input='+encodeURIComponent($(this).attr('openfile')));
                                                break;
                                }
                                $('#window_browse').dialog('close');
@@ -212,7 +212,7 @@ function browse(dir){
                        $('[openfile]').click(function(){
                                switch(tgt){
                                        case '#mobile':
-                                               sendCommand('command=in_play&input=file://'+encodeURIComponent($(this).attr('openfile')),"window.location='mobile.html'");
+                                               sendCommand('command=in_play&input='+encodeURIComponent($(this).attr('openfile')),"window.location='mobile.html'");
                                                break;
                                        default:
                                                break;
index bed51a0e9d936f039febdb4634c7611fea015cb7..3bc75f58b4c6039374002f6ce7642c2e39dce21b 100644 (file)
@@ -341,15 +341,21 @@ getbrowsetable = function ()
     local uri = _GET["uri"]
     --uri takes precedence, but fall back to dir
     if uri then
-        dir = vlc.strings.make_path(uri)
+        if uri == "file://~" then
+            dir = uri
+        else
+            dir = vlc.strings.make_path(uri)
+        end
     else
         dir = _GET["dir"]
     end
 
     --backwards compatibility with old format driveLetter:\\..
     --this is forgiving with the slash type and number
-    local position=string.find(dir, '%a:[\\/]*%.%.',0)
-    if position==1 then dir="" end
+    if dir then
+        local position=string.find(dir, '%a:[\\/]*%.%.',0)
+        if position==1 then dir="" end
+    end
 
     local result={}
     --paths are returned as an array of elements
@@ -357,7 +363,7 @@ getbrowsetable = function ()
     result.element._array={}
 
     if dir then
-        if dir == "~" then dir = vlc.misc.homedir() end
+        if dir == "~" or dir == "file://~" then dir = vlc.misc.homedir() end
         -- FIXME: hack for Win32 drive list
         if dir~="" then
             dir = common.realpath(dir.."/")