mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-21 04:25:31 +01:00
Fix #316
This commit is contained in:
parent
9236b5a05a
commit
fea65749e6
2 changed files with 4 additions and 3 deletions
|
|
@ -160,4 +160,4 @@ def sanitize_file_name(name):
|
|||
Also remove path separators. ALl illegal characters are replaced by
|
||||
underscores.
|
||||
'''
|
||||
return re.sub(r'[:\?\\\/]|^-', '_', name.strip())
|
||||
return re.sub(r'[\|\~\:\?\\\/]|^-', '_', name.strip())
|
||||
|
|
@ -20,7 +20,8 @@
|
|||
from httplib import responses
|
||||
from optparse import OptionParser
|
||||
|
||||
from libprs500 import __version__, __appname__, __author__, setup_cli_handlers, browser
|
||||
from libprs500 import __version__, __appname__, __author__, setup_cli_handlers, \
|
||||
browser, sanitize_file_name
|
||||
from libprs500.ebooks.BeautifulSoup import BeautifulSoup
|
||||
|
||||
class FetchError(Exception):
|
||||
|
|
@ -191,7 +192,7 @@ def process_images(self, soup, baseurl):
|
|||
self.logger.debug('Error: %s', str(err), exc_info=True)
|
||||
continue
|
||||
c += 1
|
||||
imgpath = os.path.join(diskpath, 'img'+str(c)+ext)
|
||||
imgpath = os.path.join(diskpath, sanitize_file_name('img'+str(c)+ext))
|
||||
self.imagemap[iurl] = imgpath
|
||||
open(imgpath, 'wb').write(f.read())
|
||||
tag['src'] = imgpath
|
||||
|
|
|
|||
Loading…
Reference in a new issue