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

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


vlc/vlc-3.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Tue Aug 18 16:59:51 2020 +0200| [0915d2e4232b23e76f8344ee6c3c6b3110223d7e] | 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.

(cherry picked from commit 6f2efad15d4a5167e0afa511fdb59cdc0aa0cb2c)
Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

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

 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 094bf3baa0..252874c397 100644
--- a/share/lua/intf/modules/httprequests.lua
+++ b/share/lua/intf/modules/httprequests.lua
@@ -405,11 +405,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
@@ -418,15 +417,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