Skip to content

Commit

Permalink
Allow relative path in unix socket URLs
Browse files Browse the repository at this point in the history
Close #123

Signed-off-by: Salvatore Mesoraca <[email protected]>
  • Loading branch information
aiven-sal committed Dec 13, 2024
1 parent f8fc065 commit 1ab1efa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions valkey/_parsers/url_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ def parse_url(url: str, async_connection: bool):
supported_schemes = ["valkey", "valkeys", "redis", "rediss", "unix"]
parsed: ParseResult = urlparse(url)
kwargs: ConnectKwargs = {}
lower_url = url.lower()
pattern = re.compile(
r"^(?:" + "|".join(map(re.escape, supported_schemes)) + r")://", re.IGNORECASE
r"^(?:" + "|".join(map(re.escape, supported_schemes)) + r")://"
)
if not pattern.match(url):
if not pattern.match(lower_url) and not lower_url.startswith("unix:"):
raise ValueError(
f"Valkey URL must specify one of the following schemes {supported_schemes}"
)
Expand Down

0 comments on commit 1ab1efa

Please sign in to comment.