mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 20:23:43 +02:00
News download: Handle URLs that have commas and non ascii characters correctly
This commit is contained in:
parent
5b4b130468
commit
e9254aa75a
2 changed files with 3 additions and 3 deletions
|
|
@ -55,7 +55,7 @@ def convert(self, stream, options, file_ext, log,
|
|||
html = convert_markdown(txt, disable_toc=options.markdown_disable_toc)
|
||||
except RuntimeError:
|
||||
raise ValueError('This txt file has malformed markup, it cannot be'
|
||||
'converted by calibre. See http://daringfireball.net/projects/markdown/syntax')
|
||||
' converted by calibre. See http://daringfireball.net/projects/markdown/syntax')
|
||||
else:
|
||||
html = convert_basic(txt)
|
||||
|
||||
|
|
|
|||
|
|
@ -191,9 +191,9 @@ def fetch_url(self, url):
|
|||
if isinstance(url, unicode):
|
||||
url = url.encode('utf-8')
|
||||
# Not sure is this is really needed as I think mechanize
|
||||
# handles quoting automatically, but leaving it in
|
||||
# handles quoting automatically, but leaving it
|
||||
# in case it breaks something
|
||||
if re.search(r'\s+|,', url) is not None:
|
||||
if re.search(r'\s+', url) is not None:
|
||||
purl = list(urlparse.urlparse(url))
|
||||
for i in range(2, 6):
|
||||
purl[i] = quote(purl[i])
|
||||
|
|
|
|||
Loading…
Reference in a new issue