[YoutubeDL] Raise syntax error for format selection expressions with …

…multiple + operators (closes #27803)
This commit is contained in:
=?UTF-8?q?Sergey=20M=E2=80=A4?= 2021-02-26 16:12:06 +01:00 committed by Dominika
parent 9fb1f50a15
commit 6ec432f9e4
2 changed files with 3 additions and 0 deletions

View file

@ -1230,6 +1230,8 @@ class HaruhiDL(object):
group = _parse_format_selection(tokens, inside_group=True)
current_selector = FormatSelector(GROUP, group, [])
elif string == '+':
if inside_merge:
raise syntax_error('Unexpected "+"', start)
video_selector = current_selector
audio_selector = _parse_format_selection(tokens, inside_merge=True)
if not video_selector or not audio_selector:

View file

@ -467,6 +467,7 @@ class TestFormatSelection(unittest.TestCase):
assert_syntax_error('+bestaudio')
assert_syntax_error('bestvideo+')
assert_syntax_error('/')
assert_syntax_error('bestvideo+bestvideo+bestaudio')
def test_format_filtering(self):
formats = [