]> gitweb @ CieloNegro.org - youtube-dl.git/blobdiff - youtube_dl/utils.py
[utils] Improve urljoin
[youtube-dl.git] / youtube_dl / utils.py
index 694e9a600387977cd99f0af5ba63e87d26ba0f5e..528d87bb9d9d1bc542ff6310d74815cc2e801113 100644 (file)
@@ -1703,9 +1703,9 @@ def base_url(url):
 def urljoin(base, path):
     if not isinstance(path, compat_str) or not path:
         return None
-    if re.match(r'https?://', path):
+    if re.match(r'^(?:https?:)?//', path):
         return path
-    if not isinstance(base, compat_str) or not re.match(r'https?://', base):
+    if not isinstance(base, compat_str) or not re.match(r'^(?:https?:)?//', base):
         return None
     return compat_urlparse.urljoin(base, path)