eidoriantan / mp3tag.js

MP3 tagging library written in pure JavaScript for Node.js and browsers
https://mp3tag.js.org
MIT License
85 stars 9 forks source link

Support more than two frames of the same type in v2.4 #619

Closed rsolorio closed 1 year ago

rsolorio commented 1 year ago

I was trying to use the library to save multiple artists and multiple genre frames in compliance with Id3v2.4; although the library suports multiple frames, I found a bug that causes to store only two frames at most.

I'm using the '\' (double backslash) separator to specify multiple values; for instance, if I want to save three genre frames I would do something like this: Genre1\Genre2\Genre3; but this ends up with two frames: Genre1 and Genre2\Genre3.

I think the problem is that the write.textFrame function uses a value.replace to identify and replace the separator; the issue is that the replace only works for the first occurrence in the string; you need to use either replaceAll or a regex to replace all occurrences at once.

eidoriantan commented 1 year ago

This issue should be fixed in v3.4.2 release. Thank you for reporting this!