fix determine_ext helper to check in KNOWN_EXTENSION

This commit is contained in:
slocum 2017-04-19 22:42:08 +02:00
parent 3461f5db06
commit b5e11ba0a5

View File

@ -1209,7 +1209,7 @@ def determine_ext(url, default_ext='unknown_video'):
if url is None:
return default_ext
guess = url.partition('?')[0].rpartition('.')[2]
if re.match(r'^[A-Za-z0-9]+$', guess):
if re.match(r'^[A-Za-z0-9]+$', guess) and guess in KNOWN_EXTENSIONS:
return guess
# Try extract ext from URLs like http://example.com/foo/bar.mp4/?download
elif guess.rstrip('/') in KNOWN_EXTENSIONS: