fix: resolve bugs found in pre-release review

This commit is contained in:
Mathis Maquenne
2026-08-05 21:33:08 +02:00
parent 5bb1448650
commit a695fb4de3
17 changed files with 258 additions and 60 deletions
+6 -5
View File
@@ -51,15 +51,16 @@ func (t *flacTagger) write(m Metadata) error {
t.file.Meta = append(t.file.Meta, &cmtsMeta)
}
picture, err := flacpicture.NewFromImageData(flacpicture.PictureTypeFrontCover, "Front cover", m.Cover, "image/jpeg")
if err != nil {
return err
if len(m.Cover) > 0 {
if picture, err := flacpicture.NewFromImageData(flacpicture.PictureTypeFrontCover, "Front cover", m.Cover, "image/jpeg"); err == nil {
pictureMeta := picture.Marshal()
t.file.Meta = append(t.file.Meta, &pictureMeta)
}
}
pictureMeta := picture.Marshal()
t.file.Meta = append(t.file.Meta, &pictureMeta)
tmpPath := t.path + ".tmp"
if err := t.file.Save(tmpPath); err != nil {
os.Remove(tmpPath)
return err
}
return os.Rename(tmpPath, t.path)