Skip to content

Commit 074cb03

Browse files
committed
Unquote special characters in URL components
1 parent f45661e commit 074cb03

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

singlestoredb/connection.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from typing import Tuple
2121
from typing import Union
2222
from urllib.parse import parse_qs
23+
from urllib.parse import unquote_plus
2324
from urllib.parse import urlparse
2425

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

288+
if out.get('user'):
289+
out['user'] = unquote_plus(out['user'])
290+
291+
if out.get('password'):
292+
out['password'] = unquote_plus(out['password'])
293+
294+
if out.get('database'):
295+
out['database'] = unquote_plus(out['database'])
296+
287297
# Convert query string to parameters
288298
out.update({k.lower(): v[-1] for k, v in parse_qs(parts.query).items()})
289299

0 commit comments

Comments
 (0)