quintodrome/utils
Deluan Quintão 91fab68578
fix: handle UTF BOM in lyrics and playlist files (#4637)
* fix: handle UTF-8 BOM in lyrics and playlist files

Added UTF-8 BOM (Byte Order Mark) detection and stripping for external lyrics files and playlist files. This ensures that files with BOM markers are correctly parsed and recognized as synced lyrics or valid playlists.

The fix introduces a new ioutils package with UTF8Reader and UTF8ReadFile functions that automatically detect and remove UTF-8, UTF-16 LE, and UTF-16 BE BOMs. These utilities are now used when reading external lyrics and playlist files to ensure consistent parsing regardless of BOM presence.

Added comprehensive tests for BOM handling in both lyrics and playlists, including test fixtures with actual BOM markers to verify correct behavior.

* test: add test for UTF-16 LE encoded LRC files

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-10-31 09:07:23 -04:00
..
cache feat(ui): add Now Playing panel for admins (#4209) 2025-06-10 17:22:13 -04:00
chrono test: improve test reliability with longer sleep durations and generous tolerances 2025-05-25 22:03:55 -04:00
gg feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
gravatar feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
hasher fix(subsonic): random albums not reshuffling. 2024-09-20 16:59:46 -04:00
ioutils fix: handle UTF BOM in lyrics and playlist files (#4637) 2025-10-31 09:07:23 -04:00
merge Upgrade Go to 1.23 (#3190) 2024-08-19 17:47:54 -04:00
number Remove duplicated test 2024-05-11 20:15:02 -04:00
pl Use sync/atomic package, now that we are at Go 1.19 2023-02-15 21:21:59 -05:00
random Fix G404 gosec lint error 2024-05-19 21:55:19 -04:00
req fix(subsonic): clearing playlist comment and public in Subsonic API (#4258) 2025-06-24 08:50:06 -04:00
run refactor: rename chain package to run and update references 2025-06-14 17:19:06 -04:00
singleton feat(plugins): experimental support for plugins (#3998) 2025-06-22 20:45:38 -04:00
slice fix(server): import absolute paths in m3u (#3756) 2025-02-26 22:26:38 -05:00
str feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
context.go Refactored agents calling into its own struct 2021-06-08 17:00:02 -04:00
context_test.go Upgrade Ginkgo to V2 2022-07-26 16:53:17 -04:00
encrypt.go feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
encrypt_test.go Upgrade Ginkgo to V2 2022-07-26 16:53:17 -04:00
files.go feat(plugins): experimental support for plugins (#3998) 2025-06-22 20:45:38 -04:00
files_test.go feat: Multi-library support (#4181) 2025-07-18 18:41:12 -04:00
index_group_parser.go More micro-optimizations 2024-06-06 07:11:43 -04:00
index_group_parser_test.go Upgrade Ginkgo to V2 2022-07-26 16:53:17 -04:00
limiter.go feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
time.go fix(scanner): always refresh folder image time when adding first image (#3764) 2025-03-06 22:16:37 -05:00
time_test.go fix(scanner): always refresh folder image time when adding first image (#3764) 2025-03-06 22:16:37 -05:00
utils_suite_test.go Upgrade Ginkgo to V2 2022-07-26 16:53:17 -04:00