fix(converter): preserve OriginalName through conversion and fix race

- Fix critical bug: convertPageFile and splitAndConvert now copy
  OriginalName to the output PageFile so --keep-filenames works
  end-to-end on actually-converted pages.
- Fix concurrency race: ExtractChapter deduplicates OriginalName when
  source archive has same base filename in different subdirectories.
- Fix collision fallback: resolvePageName loops until an unused
  indexed name is found instead of single-shot assignment.
- Fix gofmt indentation in optimize_command.go.
This commit is contained in:
Antoine Aflalo
2026-07-21 19:45:25 -04:00
parent f3ba585c13
commit 21f92bc6f5
5 changed files with 147 additions and 19 deletions
+7 -4
View File
@@ -251,11 +251,13 @@ func (converter *Converter) convertPageFile(ctx context.Context, page *manga.Pag
err := EncodeFile(page.FilePath, outputPath, uint(quality))
if err == nil {
// Success! No image decoding needed.
// Success! No image decoding needed. Preserve OriginalName so
// --keep-filenames carries through to the final zip entry name.
return []*manga.PageFile{{
Index: page.Index,
Extension: ".webp",
FilePath: outputPath,
Index: page.Index,
Extension: ".webp",
FilePath: outputPath,
OriginalName: page.OriginalName,
}}, nil
}
@@ -356,6 +358,7 @@ func (converter *Converter) splitAndConvert(ctx context.Context, page *manga.Pag
FilePath: outputPath,
IsSplitted: true,
SplitPartIndex: uint16(i),
OriginalName: page.OriginalName,
})
}