mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-22 08:13:18 +02:00
Store: Download, ensure download filename is ascii.
This commit is contained in:
parent
64729ef1ab
commit
7a75239843
2 changed files with 6 additions and 2 deletions
|
|
@ -17,6 +17,7 @@
|
|||
win32event, win32api, winerror, fcntl,
|
||||
filesystem_encoding, plugins, config_dir)
|
||||
from calibre.startup import winutil, winutilerror
|
||||
from calibre.utils.filenames import ascii_filename
|
||||
|
||||
if False and islinux and not getattr(sys, 'frozen', False):
|
||||
# Imported before PyQt4 to workaround PyQt4 util-linux conflict discovered on gentoo
|
||||
|
|
@ -648,7 +649,10 @@ def get_download_filename(url, cookie_file=None):
|
|||
if not filename:
|
||||
filename = last_part_name
|
||||
|
||||
return filename
|
||||
filename, ext = os.path.splitext(filename)
|
||||
filename = filename[:60] + ext
|
||||
|
||||
return ascii_filename(filename)
|
||||
|
||||
def human_readable(size):
|
||||
""" Convert a size in bytes into a human readable form """
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ def _download(self, cookie_file, url, filename, save_loc, add_to_lib):
|
|||
return dfilename
|
||||
|
||||
if not filename:
|
||||
filename = get_download_filename(url, cookie_file)[:60]
|
||||
filename = get_download_filename(url, cookie_file)
|
||||
|
||||
br = browser()
|
||||
if cookie_file:
|
||||
|
|
|
|||
Loading…
Reference in a new issue