Bugzilla – Bug 13788
URLs passed to image proxy need to be escaped
Last modified: 2009-10-05 14:30:52 UTC
For example, /public/imageproxy?w=180&h=180&f=&u=http://api.napster.com/cgi-bin/image-uri?type=track&id=28494546&country_code=GB won't work. Is there an existing way to URI-escape in our Lua code?
To my knowledge we don't have anything, but I'm sure someone has written a lua function already that we could add to our jive.utils.string extension of the string library. Assign to me as you see fit...
from CGILua http://www.keplerproject.org/cgilua/index.html#overview ---------------------------------------------------------------------------- -- Decode an URL-encoded string (see RFC 2396) ---------------------------------------------------------------------------- function unescape (str) str = string.gsub (str, "+", " ") str = string.gsub (str, "%%(%x%x)", function(h) return string.char(tonumber(h,16)) end) str = string.gsub (str, "\r\n", "\n") return str end ---------------------------------------------------------------------------- -- URL-encode a string (see RFC 2396) ---------------------------------------------------------------------------- function escape (str) str = string.gsub (str, "\n", "\r\n") str = string.gsub (str, "([^0-9a-zA-Z ])", -- locale independent function (c) return string.format ("%%%02X", string.byte(c)) end) str = string.gsub (str, " ", "+") return str end
OK, that escape function looks good enough. Do you want to add that?
sure
== Auto-comment from SVN commit #7344 to the jive repo by bklaas == == https://svn.slimdevices.com/jive?view=revision&revision=7344 == Bug: 13788 Description: add string methods for urlEncode() and urlDecode() lua files that use this must point to the extended string library like so local string = require('jive.utils.string')
back to you Andy
== Auto-comment from SVN commit #7345 to the jive repo by andy == == https://svn.slimdevices.com/jive?view=revision&revision=7345 == Fixed bug 13788, urlEncode imageproxy URL param
This bug has been marked as fixed in the 7.4.0 release version of SqueezeBox Server! * SqueezeCenter: 28672 * Squeezebox 2 and 3: 130 * Transporter: 80 * Receiver: 65 * Boom: 50 * Controller: 7790 * Radio: 7790 Please see the Release Notes for all the details: http://wiki.slimdevices.com/index.php/Release_Notes If you haven't already, please download and install the new version from http://www.logitechsqueezebox.com/support/download-squeezebox-server.html If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.