[vlc-commits] lua: http: fix artwork not being displayed on windows.

Sam Malone git at videolan.org
Fri Jan 24 10:47:10 CET 2014


vlc | branch: master | Sam Malone <samicemalone at gmail.com> | Fri Jan 24 09:24:42 2014 +0000| [b729c33b249e1eaf79cb2071668a05a0368101f2] | committer: Jean-Baptiste Kempf

lua: http: fix artwork not being displayed on windows.

Close #7607

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 share/lua/intf/http.lua |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/share/lua/intf/http.lua b/share/lua/intf/http.lua
index 9a7926c..bc9c6e1 100644
--- a/share/lua/intf/http.lua
+++ b/share/lua/intf/http.lua
@@ -156,9 +156,13 @@ function callback_art(data, request, args)
         end
         local metas = item:metas()
         local filename = vlc.strings.decode_uri(string.gsub(metas["artwork_url"],"file://",""))
+        local windowsdrive = string.match(filename, "^/%a:/.+$")  --match windows drive letter
+        if windowsdrive then
+            filename = string.sub(filename, 2)  --remove starting forward slash before the drive letter
+        end
         local size = vlc.net.stat(filename).size
         local ext = string.match(filename,"%.([^%.]-)$")
-        local raw = io.open(filename):read("*a")
+        local raw = io.open(filename, 'rb'):read("*a")
         local content = [[Content-Type: ]]..mimes[ext]..[[
 
 Content-Length: ]]..size..[[



More information about the vlc-commits mailing list