mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2026-07-22 11:25:40 +02:00
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:
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user