mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
[Bug] Unable to output SNB file due to file path encodings.
This commit is contained in:
parent
da20127ec5
commit
f34e474727
@ -156,6 +156,8 @@ class SNBFile:
|
|||||||
f.fileSize = os.path.getsize(os.path.join(tdir,fileName))
|
f.fileSize = os.path.getsize(os.path.join(tdir,fileName))
|
||||||
f.fileBody = open(os.path.join(tdir,fileName), 'rb').read()
|
f.fileBody = open(os.path.join(tdir,fileName), 'rb').read()
|
||||||
f.fileName = fileName.replace(os.sep, '/')
|
f.fileName = fileName.replace(os.sep, '/')
|
||||||
|
if isinstance(f.fileName, unicode):
|
||||||
|
f.fileName = f.fileName.encode("ascii", "ignore");
|
||||||
self.files.append(f)
|
self.files.append(f)
|
||||||
|
|
||||||
def AppendBinary(self, fileName, tdir):
|
def AppendBinary(self, fileName, tdir):
|
||||||
@ -164,6 +166,8 @@ class SNBFile:
|
|||||||
f.fileSize = os.path.getsize(os.path.join(tdir,fileName))
|
f.fileSize = os.path.getsize(os.path.join(tdir,fileName))
|
||||||
f.fileBody = open(os.path.join(tdir,fileName), 'rb').read()
|
f.fileBody = open(os.path.join(tdir,fileName), 'rb').read()
|
||||||
f.fileName = fileName.replace(os.sep, '/')
|
f.fileName = fileName.replace(os.sep, '/')
|
||||||
|
if isinstance(f.fileName, unicode):
|
||||||
|
f.fileName = f.fileName.encode("ascii", "ignore");
|
||||||
self.files.append(f)
|
self.files.append(f)
|
||||||
|
|
||||||
def GetFileStream(self, fileName):
|
def GetFileStream(self, fileName):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user