1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 01:36:27 +00:00

fix file splitting/chunking for real in certain situations (#839)

* fix file splitting without ComicInfo.xml

* remove dead var
This commit is contained in:
Alex Xu
2025-02-28 19:19:11 -08:00
committed by GitHub
parent 4b3cd6882a
commit 11186d07c0

View File

@@ -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)