Skip to content

Commit

Permalink
Improve proxy URL regex matching (#2155)
Browse files Browse the repository at this point in the history
  • Loading branch information
zigzag1001 authored Aug 19, 2024
1 parent 49dbaec commit c8179e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spotdl/download/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def __init__(
proxy = self.settings["proxy"]
proxies = None
if proxy:
if not re.match(pattern=r"(http|https)://\d{1,5}", string=proxy):
if not re.match(pattern=r"^(http|https):\/\/(?:(\w+)(?::(\w+))?@)?((?:\d{1,3})(?:\.\d{1,3}){3})(?::(\d{1,5}))?$", string=proxy):
raise DownloaderError(f"Invalid proxy server: {proxy}")
proxies = {"http": proxy, "https": proxy}
logger.info("Setting proxy server: %s", proxy)
Expand Down

0 comments on commit c8179e9

Please sign in to comment.