mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
News download: Handle URLs that have commas and non ascii characters correctly
This commit is contained in:
parent
5b4b130468
commit
e9254aa75a
@ -55,7 +55,7 @@ class TXTInput(InputFormatPlugin):
|
|||||||
html = convert_markdown(txt, disable_toc=options.markdown_disable_toc)
|
html = convert_markdown(txt, disable_toc=options.markdown_disable_toc)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
raise ValueError('This txt file has malformed markup, it cannot be'
|
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:
|
else:
|
||||||
html = convert_basic(txt)
|
html = convert_basic(txt)
|
||||||
|
|
||||||
|
@ -191,9 +191,9 @@ class RecursiveFetcher(object):
|
|||||||
if isinstance(url, unicode):
|
if isinstance(url, unicode):
|
||||||
url = url.encode('utf-8')
|
url = url.encode('utf-8')
|
||||||
# Not sure is this is really needed as I think mechanize
|
# 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
|
# 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))
|
purl = list(urlparse.urlparse(url))
|
||||||
for i in range(2, 6):
|
for i in range(2, 6):
|
||||||
purl[i] = quote(purl[i])
|
purl[i] = quote(purl[i])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user