From 11186d07c0c622909c4b992a43c2c0628e854308 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Fri, 28 Feb 2025 19:19:11 -0800 Subject: [PATCH] fix file splitting/chunking for real in certain situations (#839) * fix file splitting without ComicInfo.xml * remove dead var --- kindlecomicconverter/comic2ebook.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index 0109173..02eed1c 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -657,16 +657,14 @@ def getWorkFolder(afile): path = cbx.extract(workdir) sanitizePermissions(path) tdir = os.listdir(workdir) - is_nested_single_dir = False if len(tdir) == 2 and 'ComicInfo.xml' in tdir: tdir.remove('ComicInfo.xml') - is_nested_single_dir = os.path.isdir(os.path.join(workdir, tdir[0])) - if is_nested_single_dir: + if os.path.isdir(os.path.join(workdir, tdir[0])): os.replace( os.path.join(workdir, 'ComicInfo.xml'), os.path.join(workdir, tdir[0], 'ComicInfo.xml') ) - if len(tdir) == 1 and is_nested_single_dir: + if len(tdir) == 1 and os.path.isdir(os.path.join(workdir, tdir[0])): path = os.path.join(workdir, tdir[0]) except OSError as e: rmtree(workdir, True)