1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-24 00:23:27 +00:00
mpv/player/lua
George Brooke 1a3e85ec33 ytdl_hook: fix url_is_safe to match URL protocols properly
Some youtube_dl extractors retrieve URLs which contain other URLs
inside of them, for example Funimation, like this:
https://example.com/video?parameter=https://example.net/something

The url_is_safe function uses a pattern to match the protocol at the
start of the URL. Before this commit, this pattern was not compliant
with the URL spec (see the definition of "A URL-scheme string"):
https://url.spec.whatwg.org/#url-writing
Therefore it would match any characters, including "://", until the
last occurence of "://" in the string. Thus the above URL would match
https://example.com/video?parameter=https
which is not in safe_protos so the video will not play.

Now the protocol can only start with a letter and only contain
alphanumerics, "." "+" or "-" as the spec says, so it will only match
the first protocol in the URL ("https" in the above example.)
Previously the URL also had to contain "//" after the ":". Data URLs
do not contain "//": https://datatracker.ietf.org/doc/html/rfc2397
so now the pattern does not look for "//", only ":".
2022-03-02 20:59:33 +02:00
..
assdraw.lua
auto_profiles.lua auto_profiles.lua: don't warn if profile-restore=default 2022-01-30 15:13:10 +02:00
console.lua console.lua: define remaining emacs keybindings 2021-11-01 23:42:16 +11:00
defaults.lua lua: remove mp.suspend, resume and resume_all 2021-12-15 12:29:10 +01:00
options.lua lua: read_options: quote values at error messages 2021-08-10 11:00:18 +03:00
osc.lua osc.lua: seekbar hover: speed-up chapter access 2022-02-06 11:02:39 +02:00
stats.lua stats.lua: page 2 - frame timing: use fixed display order 2022-02-23 02:20:49 +02:00
ytdl_hook.lua ytdl_hook: fix url_is_safe to match URL protocols properly 2022-03-02 20:59:33 +02:00