diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-02-12 11:37:06 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-02-24 10:37:24 +0100 |
commit | 554d93ea1516d750fcf164e4f4d09edda10000d8 (patch) | |
tree | 7bf0274767c615797dd7e66e8e226e35998de893 | |
parent | 80eb185a9b222f50f2a23586147f93339c7779d8 (diff) | |
download | urlgrabber-554d93ea1516d750fcf164e4f4d09edda10000d8.tar.gz |
Preserve type in URLParser.quote()
-rw-r--r-- | urlgrabber/grabber.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py index 53f9f87..e8a7ffc 100644 --- a/urlgrabber/grabber.py +++ b/urlgrabber/grabber.py @@ -883,8 +883,10 @@ class URLParser: passing into urlgrabber. """ (scheme, host, path, parm, query, frag) = parts - path = urlquote(path, safe='/$') - return (scheme, host, path, parm, query, frag) + newpath = urlquote(path, safe='/$') + if not isinstance(path, text_type) and isinstance(newpath, text_type): + newpath = newpath.encode('utf8') + return (scheme, host, newpath, parm, query, frag) hexvals = '0123456789ABCDEF' def guess_should_quote(self, parts): |