mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Fix a bug in translate(): the pointer was incremented by the length of
the *escaped* url. Also added new special characters that are not part of the url when found at the end: ( < > .
This commit is contained in:
parent
bef74b5605
commit
0721358969
1 changed files with 2 additions and 2 deletions
|
@ -87,8 +87,9 @@ def translate(text, pre=0):
|
||||||
list.append(escape(text[i:j]))
|
list.append(escape(text[i:j]))
|
||||||
i = j
|
i = j
|
||||||
url = prog.group(0)
|
url = prog.group(0)
|
||||||
while url[-1] in ');:,.?\'"':
|
while url[-1] in '();:,.?\'"<>':
|
||||||
url = url[:-1]
|
url = url[:-1]
|
||||||
|
i = i + len(url)
|
||||||
url = escape(url)
|
url = escape(url)
|
||||||
if not pre or (pre and PROCESS_PREFORMAT):
|
if not pre or (pre and PROCESS_PREFORMAT):
|
||||||
if ':' in url:
|
if ':' in url:
|
||||||
|
@ -98,7 +99,6 @@ def translate(text, pre=0):
|
||||||
else:
|
else:
|
||||||
repl = url
|
repl = url
|
||||||
list.append(repl)
|
list.append(repl)
|
||||||
i = i + len(url)
|
|
||||||
j = len(text)
|
j = len(text)
|
||||||
list.append(escape(text[i:j]))
|
list.append(escape(text[i:j]))
|
||||||
return string.join(list, '')
|
return string.join(list, '')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue