]> git.sesse.net Git - vlc/commitdiff
lua http: fix valid uri handling with v2.
authorFrancois Cartegnie <fcvlcdev@free.fr>
Sat, 24 Sep 2011 19:18:01 +0000 (21:18 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Sat, 24 Sep 2011 22:14:47 +0000 (00:14 +0200)
Correct uri are not escaped, so we must not unescape them.
Adding a version query string for our web intf to keep backward compatibility.

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

index 5d3e3381e1f65b512d7ac95e76ecaea5a6684a32..0d3680e6a3e861c7603b1b623d426448400854ec 100644 (file)
@@ -195,7 +195,7 @@ function browse(dir){
                                        case '#mobile':
                                                break;
                                        default:
-                                               sendCommand('command=in_play&input='+encodeURIComponent($(this).attr('openfile')));
+                                               sendCommand('command=in_play&v=2&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='+encodeURIComponent($(this).attr('openfile')),"window.location='mobile.html'");
+                                               sendCommand('command=in_play&v=2&input='+encodeURIComponent($(this).attr('openfile')),"window.location='mobile.html'");
                                                break;
                                        default:
                                                break;
index 131f164db100f7a9587744bbe0526007a9666d37..0afdc24e29f5f3a8218433b55a918fa1ce72127e 100644 (file)
@@ -71,10 +71,12 @@ processcommands = function ()
 
        local input = _GET['input']
        local command = _GET['command']
+       local version = tonumber(_GET['v'] or 1)
        local id = tonumber(_GET['id'] or -1)
        local val = _GET['val']
        local options = _GET['option']
        local band = _GET['band']
+       local decodedpath
        if type(options) ~= "table" then -- Deal with the 0 or 1 option case
          options = { options }
        end
@@ -87,11 +89,16 @@ processcommands = function ()
          end
          vlc.msg.err( "</options>" )
          --]]
-         vlc.playlist.add({{path=stripslashes(input),options=options}})
+         if version == 2 then
+               decodedpath = input
+         else
+               decodedpath = stripslashes(input)
+         end
+         vlc.playlist.add({{path=decodedpath,options=options}})
        elseif command == "addsubtitle" then
          vlc.input.add_subtitle (stripslashes(val))
        elseif command == "in_enqueue" then
-         vlc.playlist.enqueue({{path=stripslashes(input),options=options}})
+         vlc.playlist.enqueue({{path=decodedpath,options=options}})
        elseif command == "pl_play" then
          if id == -1 then
                vlc.playlist.play()