Skip to content

Commit

Permalink
Unquote special characters in URL components
Browse files Browse the repository at this point in the history
  • Loading branch information
kesmit13 committed Nov 19, 2024
1 parent f45661e commit 074cb03
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions singlestoredb/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from typing import Tuple
from typing import Union
from urllib.parse import parse_qs
from urllib.parse import unquote_plus
from urllib.parse import urlparse

import sqlparams
Expand Down Expand Up @@ -284,6 +285,15 @@ def _parse_url(url: str) -> Dict[str, Any]:
if parts.scheme != 'singlestoredb':
out['driver'] = parts.scheme.lower()

if out.get('user'):
out['user'] = unquote_plus(out['user'])

if out.get('password'):
out['password'] = unquote_plus(out['password'])

if out.get('database'):
out['database'] = unquote_plus(out['database'])

# Convert query string to parameters
out.update({k.lower(): v[-1] for k, v in parse_qs(parts.query).items()})

Expand Down

0 comments on commit 074cb03

Please sign in to comment.