[vlc-commits] VLSub: Fix filename extraction on non local files

Hugo Beauzée-Luyssen git at videolan.org
Wed Apr 18 16:05:34 CEST 2018


vlc/vlc-3.0 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Apr 18 15:55:53 2018 +0200| [b3a1510feb1360c28feea3ba9e2996179b183986] | committer: Hugo Beauzée-Luyssen

VLSub: Fix filename extraction on non local files

(cherry picked from commit dff8182b392000b7fe30b584d1383f82170c6390)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 share/lua/extensions/VLSub.lua | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/share/lua/extensions/VLSub.lua b/share/lua/extensions/VLSub.lua
index 1b76733adf..6fc73e173e 100644
--- a/share/lua/extensions/VLSub.lua
+++ b/share/lua/extensions/VLSub.lua
@@ -1229,7 +1229,12 @@ openSub = {
       vlc.msg.dbg("[VLSub] Video URI: "..item:uri())
       file.uri = item:uri()
       local filePath = vlc.strings.make_path(file.uri)
-      file.dir, file.name = string.match(filePath, "^(.*[".. slash .."])([^" .. slash .. "]-).?[%a%d]*$")
+      if not filePath then
+        filePath = vlc.strings.decode_uri(file.uri)
+        filePath = string.match(filePath, "^.*[".. slash .."]([^" .. slash .. "]-).?[%a%d]*$")
+      else
+        file.dir, file.name = string.match(filePath, "^(.*[".. slash .."])([^" .. slash .. "]-).?[%a%d]*$")
+      end
       if not file.name then
         file.name = filePath
       end



More information about the vlc-commits mailing list