]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[YoutubeDL] Sanitize byte string format URLs (#13951)
authorSergey M․ <dstftw@gmail.com>
Thu, 17 Aug 2017 16:59:12 +0000 (23:59 +0700)
committerSergey M․ <dstftw@gmail.com>
Thu, 17 Aug 2017 16:59:12 +0000 (23:59 +0700)
youtube_dl/YoutubeDL.py

index df7378f8348a2b8ba671d9998395782168322c23..5f4c93ea370d794e62f0e6eee4f1f81cecd1300b 100755 (executable)
@@ -1483,12 +1483,14 @@ class YoutubeDL(object):
 
         def is_wellformed(f):
             url = f.get('url')
-            valid_url = url and isinstance(url, compat_str)
-            if not valid_url:
+            if not url:
                 self.report_warning(
                     '"url" field is missing or empty - skipping format, '
                     'there is an error in extractor')
-            return valid_url
+                return False
+            if isinstance(url, bytes):
+                sanitize_string_field(f, 'url')
+            return True
 
         # Filter out malformed formats for better extraction robustness
         formats = list(filter(is_wellformed, formats))