mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround python returning bytes based filenames on some windows systems
This commit is contained in:
parent
506022b5aa
commit
fb5e14046c
@ -11,7 +11,7 @@ import tempfile
|
||||
from functools import partial
|
||||
from urllib.parse import quote
|
||||
|
||||
from calibre.constants import isbsd, islinux
|
||||
from calibre.constants import isbsd, islinux, filesystem_encoding
|
||||
from calibre.customize.conversion import InputFormatPlugin, OptionRecommendation
|
||||
from calibre.utils.filenames import ascii_filename, get_long_path_name
|
||||
from calibre.utils.imghdr import what
|
||||
@ -88,8 +88,11 @@ class HTMLInput(InputFormatPlugin):
|
||||
|
||||
fname = None
|
||||
if hasattr(stream, 'name'):
|
||||
basedir = os.path.dirname(stream.name)
|
||||
fname = os.path.basename(stream.name)
|
||||
sname = stream.name
|
||||
if isinstance(sname, bytes):
|
||||
sname = sname.decode(filesystem_encoding)
|
||||
basedir = os.path.dirname(sname)
|
||||
fname = os.path.basename(sname)
|
||||
self.set_root_dir_of_input(basedir)
|
||||
|
||||
if file_ext != 'opf':
|
||||
|
Loading…
x
Reference in New Issue
Block a user