Skip to content

Commit

Permalink
Comic Input: Handle comics whose internal files have control codes in…
Browse files Browse the repository at this point in the history
… their filenames. Fixes #2081982 [Unicode in filename of a CBZ archive breaks due to passing it to LXML](https://bugs.launchpad.net/calibre/+bug/2081982)
  • Loading branch information
kovidgoyal committed Sep 26, 2024
1 parent 690d1ed commit 558e0a7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/calibre/ebooks/comic/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from calibre import extract, prints, walk
from calibre.constants import filesystem_encoding
from calibre.ptempfile import PersistentTemporaryDirectory
from calibre.utils.cleantext import clean_ascii_chars
from calibre.utils.icu import numeric_sort_key
from calibre.utils.ipc.job import ParallelJob
from calibre.utils.ipc.server import Server
Expand All @@ -35,7 +36,7 @@ def extract_comic(path_to_comic_file):
extract(path_to_comic_file, tdir)
for x in walk(tdir):
bn = os.path.basename(x)
nbn = bn.replace('#', '_')
nbn = clean_ascii_chars(bn.replace('#', '_'))
if nbn != bn:
os.rename(x, os.path.join(os.path.dirname(x), nbn))
return tdir
Expand Down

0 comments on commit 558e0a7

Please sign in to comment.