Skip to content

Commit 2c6f2ed

Browse files
committed
remove extraneous quote/unquote in encode_url to fix #49
1 parent 864ab23 commit 2c6f2ed

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tests/test_github_issues.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,10 @@ def test_github_issue_47():
166166
167167
yet anothe word</pre>'''
168168
assert result == expect
169+
170+
def test_github_issue_49():
171+
"""Key error on russian hash-route link"""
172+
s = '"link":https://ru.vuejs.org/v2/guide/components.html#Входные-параметры'
173+
result = textile.textile(s)
174+
expect = '\t<p><a href="https://ru.vuejs.org/v2/guide/components.html#Входные-параметры">link</a></p>'
175+
assert result == expect

textile/core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,6 @@ def encode_url(self, url):
991991
path_parts = (quote(unquote(pce), b'') for pce in
992992
parsed.path.split('/'))
993993
path = '/'.join(path_parts)
994-
fragment = quote(unquote(parsed.fragment))
995994

996995
# put it back together
997996
netloc = ''
@@ -1003,7 +1002,7 @@ def encode_url(self, url):
10031002
netloc = '{0}{1}'.format(netloc, host)
10041003
if port:
10051004
netloc = '{0}:{1}'.format(netloc, port)
1006-
return urlunsplit((scheme, netloc, path, parsed.query, fragment))
1005+
return urlunsplit((scheme, netloc, path, parsed.query, parsed.fragment))
10071006

10081007
def span(self, text):
10091008
qtags = (r'\*\*', r'\*', r'\?\?', r'\-', r'__',

0 commit comments

Comments
 (0)