Skip to content

Commit

Permalink
ytdl_hook: move url_is_safe earlier in code
Browse files Browse the repository at this point in the history
lua isn't javascript.
  • Loading branch information
wiiaboo committed Jan 26, 2018
1 parent 573bfae commit f8263e8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions player/lua/ytdl_hook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,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

Expand Down Expand Up @@ -223,15 +232,6 @@ local function proto_is_dash(json)
or json["protocol"] == "http_dash_segments"
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 = ""
local max_bitrate = 0
Expand Down

0 comments on commit f8263e8

Please sign in to comment.