navidrome/utils/cache
Deluan e42418db77 fix(windows): avoid filepath.Rel hang on UNC share roots
On Windows, filepath.Rel never returns when the base is a UNC share root
(\\host\share) and the target is the same root with a trailing separator
(golang/go#79784, fixed only in Go 1.28 by CL 786100). A user on Windows
Server with MusicFolder='\\server\Music' (discussion #6232) sent CPU
profiles showing 96% of CPU time in filepath.Rel, called from
fromArtistFolder <- resolveArtistFolderPattern <- resolver.resolveArtist.
For an album directly under the library root, loadArtistFolder's
filepath.Dir returns '\\server\Music\', so the artwork worker spins
forever and, because Worker.drain waits for the whole batch, the artist
artwork pool stops.

Add utils.RelPath, which normalizes a UNC volume root followed only by
separators to the volume plus one separator before calling filepath.Rel.
Both sides then compare equal and Rel returns '.' before reaching the
loop. A bare '\\host\share' target under a deeper base now also gives
'..' instead of an error. Drive-letter paths are left unchanged, and on
non-Windows systems the helper behaves exactly like filepath.Rel.

Use it at every production filepath.Rel call site: artist folder
artwork, scanner library-relative paths, the watcher, playlist path
resolution and PlaylistsPath matching, and the cache spread FS.

Windows-only tests cover the UNC cases, with a timeout so a regression
fails instead of hanging CI. Run under Wine, 6 of them fail with plain
filepath.Rel (4 by timeout) and all pass with RelPath. The helper can be
removed after moving to Go 1.28.
2026-09-27 15:25:19 -04:00
..
benchmark_test.go chore: go fix 2026-05-28 22:13:05 -03:00
cache_suite_test.go Rename log.LevelCritical to log.LevelFatal 2022-12-21 14:53:36 -05:00
cached_http_client.go refactor: multiple syntax updates for Go 1.26 2026-05-19 18:02:36 -03:00
cached_http_client_test.go test: fix flaky tests in utils/cache (#5567) 2026-06-05 18:06:52 -04:00
file_caches.go fix(stream): abort the response when a transcoded stream is truncated (#6035) 2026-08-25 18:48:43 -04:00
file_caches_test.go fix(stream): abort the response when a transcoded stream is truncated (#6035) 2026-08-25 18:48:43 -04:00
file_haunter.go Remove potential integer overflow conversion uint64 -> int64 2024-08-22 19:28:22 -04:00
file_haunter_test.go test: fix flaky tests in utils/cache (#5567) 2026-06-05 18:06:52 -04:00
simple_cache.go fix: dedupe and cap concurrent lyrics plugin fetches (#5792) 2026-07-16 20:10:35 -04:00
simple_cache_test.go fix: dedupe and cap concurrent lyrics plugin fetches (#5792) 2026-07-16 20:10:35 -04:00
spread_fs.go fix(windows): avoid filepath.Rel hang on UNC share roots 2026-09-27 15:25:19 -04:00
spread_fs_test.go feat(artwork): new artwork pipeline with background resolution and Low Quality Image Placeholders (#5847) 2026-08-09 15:03:27 -04:00
spread_fs_unix.go feat(artwork): new artwork pipeline with background resolution and Low Quality Image Placeholders (#5847) 2026-08-09 15:03:27 -04:00
spread_fs_windows.go feat(artwork): new artwork pipeline with background resolution and Low Quality Image Placeholders (#5847) 2026-08-09 15:03:27 -04:00