Skip to content

Commit ea9cb59

Browse files
committed
Ensure query is always dict[str, str]
1 parent ffd8087 commit ea9cb59

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

asyncpg/connect_utils.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,12 @@ def _parse_connect_dsn_and_args(*, dsn, host, port, user,
325325
password = urllib.parse.unquote(dsn_password)
326326

327327
if parsed.query:
328-
query = urllib.parse.parse_qs(parsed.query, strict_parsing=True)
329-
for key, val in query.items():
330-
if isinstance(val, list):
331-
query[key] = val[-1]
328+
query = {
329+
key: val[-1]
330+
for key, val in urllib.parse.parse_qs(
331+
parsed.query, strict_parsing=True
332+
).items()
333+
}
332334

333335
if 'port' in query:
334336
val = query.pop('port')

0 commit comments

Comments
 (0)