[vlc-commits] httprequests.lua: remove no-op code in getbrowsetable()

Pierre Ynard git at videolan.org
Tue Aug 18 17:07:31 CEST 2020


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Tue Aug 18 16:59:51 2020 +0200| [6f2efad15d4a5167e0afa511fdb59cdc0aa0cb2c] | committer: Pierre Ynard

httprequests.lua: remove no-op code in getbrowsetable()

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.

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

 share/lua/intf/modules/httprequests.lua | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/share/lua/intf/modules/httprequests.lua b/share/lua/intf/modules/httprequests.lua
index 33f2836a00..5a8a74afca 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)



More information about the vlc-commits mailing list