diff --git a/py_opengauss/project.py b/py_opengauss/project.py index 5da1c5fb4dc0dfa952d6e20ace7f5f8d866dcca2..dc5e98893f950029724fbd1c85d99b693475ca00 100644 --- a/py_opengauss/project.py +++ b/py_opengauss/project.py @@ -8,5 +8,5 @@ identity = 'http://github.com/vimiix/py-opengauss' meaculpa = 'Python+openGauss' abstract = 'Driver and tools library for openGauss' -version_info = (1, 3, 6) # dev based on py-postgresql version 1.3.0 +version_info = (1, 3, 8) # dev based on py-postgresql version 1.3.0 version = '.'.join(map(str, version_info)) diff --git a/py_opengauss/resolved/riparse.py b/py_opengauss/resolved/riparse.py index ee8b63cfcae6e8c5546e92f90f8a5a0dc7814e84..0c205d3f331752425f3c93443ee4529cf24ff8b3 100644 --- a/py_opengauss/resolved/riparse.py +++ b/py_opengauss/resolved/riparse.py @@ -40,6 +40,7 @@ percent encoded variant is decoded. """ import re import copy +from urllib.parse import quote pct_encode = '%%%0.2X'.__mod__ unescaped = '%' + ''.join([chr(x) for x in range(0, 33)]) @@ -131,11 +132,18 @@ def split(s): scheme = None break - end_of_netloc = end + split_loc = s.rfind('@', pos) + if split_loc != -1: + # quote password to a safe string + userpw = s[pos:split_loc].split(':', 1) + if len(userpw) == 2: + user, pw = userpw + safe_pw = quote(pw) + s = s[:pos] + user + ':' + safe_pw + s[split_loc:] + # update end pos from new string + end = len(s) - split_loc = s.rfind('@') - if split_loc == -1: - return scheme, netloc, path, query, fragment + end_of_netloc = end path_pos = s.rfind('/', pos) if path_pos == -1 or path_pos < split_loc: