[vlc-devel] [PATCH 1/4] httprequests.lua: remove no-op code in getbrowsetable()

Pierre Ynard linkfanel at yahoo.fr
Tue Aug 11 04:39:38 CEST 2020


It modified a variable never used afterwards, the explanatory comment
was mostly bogus, and the relevant corner case isn't something we really
want to handle. Variables are simplified accordingly.


diff --git a/share/lua/intf/modules/httprequests.lua b/share/lua/intf/modules/httprequests.lua
index 33f2836..5a8a74a 100644
--- a/share/lua/intf/modules/httprequests.lua
+++ b/share/lua/intf/modules/httprequests.lua
@@ -376,11 +376,10 @@ getbrowsetable = function ()
 
         for _,f in pairs(d) do
             if f == ".." or not string.match(f,"^%.") then
-                local df = common.realpath(dir..f)
-                local s = vlc.net.stat(df)
-                local path, name =  df, f
+                local path = common.realpath(dir..f)
                 local element={}
 
+                local s = vlc.net.stat(path)
                 if (s) then
                     for k,v in pairs(s) do
                         element[k]=v
@@ -389,15 +388,9 @@ getbrowsetable = function ()
                     element["type"]="unknown"
                 end
                 element["path"]=path
-                element["name"]=name
-
-                local uri=vlc.strings.make_uri(df)
-                --windows paths are returned with / separators, but make_uri expects \ for windows and returns nil
-                if not uri then
-                    --convert failed path to windows format and try again
-                    path=string.gsub(path,"/","\\")
-                    uri=vlc.strings.make_uri(df)
-                end
+                element["name"]=f
+
+                local uri=vlc.strings.make_uri(path)
                 element["uri"]=uri
 
                 table.insert(result.element._array,element)
-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the vlc-devel mailing list