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

Sam Malone git at videolan.org
Sun Jan 26 15:05:56 CET 2014


vlc/vlc-2.1 | branch: master | Sam Malone <samicemalone at gmail.com> | Fri Jan 24 09:24:42 2014 +0000| [d844caecfdf7ef48cf391dac0d8a2859d3d1f9d6] | 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>
(cherry picked from commit b729c33b249e1eaf79cb2071668a05a0368101f2)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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