diff options
author | Ricardo Constantino <wiiaboo@gmail.com> | 2018-01-26 11:26:27 +0000 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2018-02-10 05:49:19 -0800 |
commit | b889623768a49e81ec94def6ffe77ac5025fa7d1 (patch) | |
tree | 9ad433a5344bff33c17560f897045b84142020e3 | |
parent | db0af67e7e176a928b0c29976849bd1f876f210a (diff) | |
download | mpv-b889623768a49e81ec94def6ffe77ac5025fa7d1.tar.bz2 mpv-b889623768a49e81ec94def6ffe77ac5025fa7d1.tar.xz |
ytdl_hook: move url_is_safe earlier in code
lua isn't javascript.
-rw-r--r-- | player/lua/ytdl_hook.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index e5e739455c..60e0a92e58 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -83,6 +83,15 @@ local function edl_escape(url) return "%" .. string.len(url) .. "%" .. url end +local function url_is_safe(url) + local proto = type(url) == "string" and url:match("^(.+)://") or nil + local safe = proto and safe_protos[proto] + if not safe then + msg.error(("Ignoring potentially unsafe url: '%s'"):format(url)) + end + return safe +end + local function time_to_secs(time_string) local ret @@ -206,15 +215,6 @@ local function edl_track_joined(fragments, protocol, is_live, base) return edl .. table.concat(parts, ";") .. ";" end -local function url_is_safe(url) - local proto = type(url) == "string" and url:match("^(.+)://") or nil - local safe = proto and safe_protos[proto] - if not safe then - msg.error(("Ignoring potentially unsafe url: '%s'"):format(url)) - end - return safe -end - local function add_single_video(json) local streamurl = "" |