fix(17-02): handle float64 numeric values from Wails JSON deserialization
Wails deserializes JSON numbers from JavaScript as float64, not int. All .(int) type assertions on year, track_number, and disc_number silently failed. Add asInt() helper, replace all assertions.
This commit is contained in:
@@ -111,10 +111,21 @@ func applyFlacTextChanges(cmt *flacvorbis.MetaDataBlockVorbisComment, changes Ta
|
||||
}
|
||||
|
||||
var val string
|
||||
|
||||
if m.isInt {
|
||||
val = strconv.Itoa(v.(int))
|
||||
n, ok := asInt(v)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
val = strconv.Itoa(n)
|
||||
} else {
|
||||
val = v.(string)
|
||||
s, ok := v.(string)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
val = s
|
||||
}
|
||||
|
||||
replaceVorbisComment(cmt, m.vorbisID, val)
|
||||
|
||||
Reference in New Issue
Block a user