Show More
@@ -92,6 +92,10 if pycompat.ispy3: | |||||
92 | # (if necessary), and returns str. This is wonky. We provide a custom |
|
92 | # (if necessary), and returns str. This is wonky. We provide a custom | |
93 | # implementation that only accepts bytes and emits bytes. |
|
93 | # implementation that only accepts bytes and emits bytes. | |
94 | def quote(s, safe=r'/'): |
|
94 | def quote(s, safe=r'/'): | |
|
95 | # bytestr has an __iter__ that emits characters. quote_from_bytes() | |||
|
96 | # does an iteration and expects ints. We coerce to bytes to appease it. | |||
|
97 | if isinstance(s, pycompat.bytestr): | |||
|
98 | s = bytes(s) | |||
95 | s = urllib.parse.quote_from_bytes(s, safe=safe) |
|
99 | s = urllib.parse.quote_from_bytes(s, safe=safe) | |
96 | return s.encode('ascii', 'strict') |
|
100 | return s.encode('ascii', 'strict') | |
97 |
|
101 |
General Comments 0
You need to be logged in to leave comments.
Login now