Bugzilla – Bug 7123
blank.png URL contains 2 slashes
Last modified: 2009-09-08 09:12:53 UTC
Andy, can you add a little context to this bug? I just put in some debug and I see this in SlimBrowser when requesting blank.png. Looks correct-- 131003:4833 WARN (SlimBrowserApplet.lua:294) - /html/images/blank_56x56_p.png
Yeah I'm doing a bit more debugging. One interesting thing I see is that Jive is requesting the plugin icons wrong because they aren't defined with a leading slash: GET plugins/Picks/html/images/icon_56x56_p.png HTTP/1.1 Accept-Language: en Host: 192.168.100.12:9000 User-Agent: Jive/7.0 rexported Client-Date: Wed, 13 Feb 2008 19:17:37 GMT That's technically an invalid request even though it works.
And here is what happens on SN, and that's where the double-slash comes in: 142112:1974 DEBUG (SlimServer.lua:678) - SlimServer {SqueezeNetwork}:fetchArtworkURL(http://www.beta.squeezenetwork.com:9000/plugins/Live365/html/images/icon.png) 142112:1974 DEBUG (SlimServer.lua:713) - ..fetching artwork 142112:1974 DEBUG (SlimServer.lua:678) - SlimServer {SqueezeNetwork}:fetchArtworkURL(http://www.beta.squeezenetwork.com:9000//html/images/blank.png)
The problem is this line: item["icon"] = 'http://' .. ip .. ':' .. port .. '/' .. item["icon"] I can fix it in Jive but maybe the right thing to do is have a consistent format in SC and say that all icon URLs should have leading slashes. That means fixing some web code because if I add a leading slash to plugin icons they no longer work in the web UI.
Ben, please review this patch: --- jive/share/applets/NowPlaying/NowPlayingApplet.lua (revision 29295) +++ jive/share/applets/NowPlaying/NowPlayingApplet.lua (local) @@ -151,7 +151,14 @@ if server:isSqueezeNetwork() then -- Artwork on SN must be fetched as a normal URL local ip, port = server:getIpPort() - item["icon"] = 'http://' .. ip .. ':' .. port .. '/' .. item["icon"] + + -- Bug 7123, Add a leading slash only if needed + local isAbsolute = string.find(item["icon"], '/') + if not isAbsolute or isAbsolute != 1 then + item["icon"] = '/' .. item["icon"] + end + + item["icon"] = 'http://' .. ip .. ':' .. port .. item["icon"] server:fetchArtworkURL(item["icon"], icon, ARTWORK_SIZE) else server:fetchArtworkThumb(item["icon"], icon, _staticArtworkThumbUri, ARTWORK_SIZE)
Created attachment 2871 [details] proposed patch Here is the full patch I think we need. This fixes the non-absolute requests for plugin icons by checking for leading slashes everywhere one of these artwork URLs is generated (we should refactor this so it's not all over the place...) Can you guys review?
CC Richard and Dean for review.
patch looks fine to me. Lua has support for the ^ designation for "start of string", so this local isAbsolute = string.find(artworkUri, '/') if not isAbsolute or isAbsolute != 1 then artworkUri = '/' .. artworkUri end can be simplified to if not string.find(artworkUri, "^/") then artworkUri = "/" .. artworkUri end
OK right, the manual isn't real clear that all those string functions take a pseudo-regex.
yeah, they call them "magic characters". fancy. :)
Created attachment 2874 [details] simplified patch
Fixed in r1943.
This bug is being closed since it was resolved for a version which is now released! Please download the new version of SqueezeCenter (formerly SlimServer) at http://www.slimdevices.com/su_downloads.html If you are still seeing this bug, please re-open it and we will consider it for a future release.