A feature-rich command-line audio/video downloader
YoutubeDL: format spec: don't accept a bare '/' (#6124)
Jaime Marquínez Ferrándizd96d604e5311
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.pyindex 20f45f4397..9a3c28f8c1 100644--- a/test/test_YoutubeDL.py+++ b/test/test_YoutubeDL.py@@ -311,6 +311,7 @@ class TestFormatSelection(unittest.TestCase):assert_syntax_error('bestvideo,,best')assert_syntax_error('+bestaudio')assert_syntax_error('bestvideo+')+ assert_syntax_error('/')def test_format_filtering(self):formats = [diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.pyindex efa3254cee..c608ff91a9 100755--- a/youtube_dl/YoutubeDL.py+++ b/youtube_dl/YoutubeDL.py@@ -960,6 +960,8 @@ class YoutubeDL(object):selectors.append(current_selector)current_selector = Noneelif string == '/':+ if not current_selector:+ raise syntax_error('"/" must follow a format selector', start)first_choice = current_selectorsecond_choice = _parse_format_selection(tokens, inside_choice=True)current_selector = FormatSelector(PICKFIRST, (first_choice, second_choice), [])