[vlc-commits] lua http: fix valid uri handling with v2.

Francois Cartegnie git at videolan.org
Sun Sep 25 00:15:37 CEST 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Sep 24 21:18:01 2011 +0200| [06108030c0cc8e0bfb633319c9dae7ba7b349855] | committer: Francois Cartegnie

lua http: fix valid uri handling with v2.

Correct uri are not escaped, so we must not unescape them.
Adding a version query string for our web intf to keep backward compatibility.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=06108030c0cc8e0bfb633319c9dae7ba7b349855
---

 share/lua/http/js/controlers.js         |    4 ++--
 share/lua/intf/modules/httprequests.lua |   11 +++++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/share/lua/http/js/controlers.js b/share/lua/http/js/controlers.js
index 5d3e338..0d3680e 100644
--- a/share/lua/http/js/controlers.js
+++ b/share/lua/http/js/controlers.js
@@ -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;
diff --git a/share/lua/intf/modules/httprequests.lua b/share/lua/intf/modules/httprequests.lua
index 131f164..0afdc24 100644
--- a/share/lua/intf/modules/httprequests.lua
+++ b/share/lua/intf/modules/httprequests.lua
@@ -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()



More information about the vlc-commits mailing list