quintodrome/core
Deluan Quintão 22c3486e38
fix(server): enhance artist folder detection with directory traversal (#4151)
* fix: enhance artist folder detection with directory traversal

Enhanced fromArtistFolder function to implement directory traversal fallback for finding artist images. The original implementation only searched in the calculated artist folder, which failed for single album artists where artist.jpg files were not detected.

Changes: Modified fromArtistFolder to search up to 3 directory levels (artist folder + 2 parent levels), extracted findImageInFolder helper function for cleaner code organization, added proper boundary checks to prevent infinite traversal, maintained backward compatibility with existing functionality.

This fix ensures artist.jpg files are properly detected for single album artists while preserving all existing behavior for multi-album artists.

* refactor: address PR review suggestions

Applied review suggestions from gemini-code-assist bot:

- Added maxArtistFolderTraversalDepth constant instead of hardcoded value 3

- Updated error message to mention that parent directories were also searched

- Enhanced test assertion to verify the improved error message

* fix: improve artist folder traversal logic and enhance error logging

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

* fix: remove test for special glob characters in artist folder detection

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

* fix: add logging for artist image search in folder

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

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-05-30 18:06:14 -04:00
..
agents feat(server): add option Lastfm.ScrobbleFirstArtistOnly to send only the first artist (#4131) 2025-05-28 08:43:07 -04:00
artwork fix(server): enhance artist folder detection with directory traversal (#4151) 2025-05-30 18:06:14 -04:00
auth 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
external refactor: external_metadata -> external.Provider (#3903) 2025-04-08 21:11:09 -04:00
ffmpeg fix(server): better embedded artwork extraction with ffmpeg (#3860) 2025-03-20 19:26:40 -04:00
lyrics feat:(server): support reading lyrics from filesystem (#2897) 2025-04-30 08:10:19 -04:00
metrics feat(insights): send scanner options 2025-02-28 15:36:21 -10:00
playback 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
scrobbler chore: remove DevEnableBufferedScrobble and always enable buffered scrobbling (#3999) 2025-04-24 17:19:50 -04:00
storage 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
archiver.go feat(server): add M3U file to downloaded playlist 2025-05-27 20:13:37 -04:00
archiver_test.go feat(server): add M3U file to downloaded playlist 2025-05-27 20:13:37 -04:00
common.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
common_test.go test: add tests for userName and AbsolutePath in core/common.go 2025-04-18 11:53:47 -04:00
core_suite_test.go Rename log.LevelCritical to log.LevelFatal 2022-12-21 14:53:36 -05:00
inspect.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
media_streamer.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
media_streamer_Internal_test.go fix: forcing transcoding when client does not specify transcoding options (#3455) 2024-11-05 20:39:05 -05:00
media_streamer_test.go Add support for timeOffset in /stream endpoint 2023-12-02 13:10:36 -05:00
players.go feat(server): group Subsonic config options together 2025-03-05 12:29:30 -08:00
players_test.go Use userId in player, other fixes (#3182) 2024-08-03 13:37:21 -04:00
playlists.go fix(server): import absolute paths in m3u (#3756) 2025-02-26 22:26:38 -05:00
playlists_test.go fix(server): import absolute paths in m3u (#3756) 2025-02-26 22:26:38 -05:00
share.go feat(server): add DefaultShareExpiration config option (#4082) 2025-05-20 22:17:30 -04:00
share_test.go Add option to allow share to be downloaded 2023-03-10 23:33:29 -05:00
wire_providers.go refactor: external_metadata -> external.Provider (#3903) 2025-04-08 21:11:09 -04:00