Repository navigation
fix(songs): list single-segment folders such as /music (#61) - #62
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #61.
With
MUSIC_FOLDERS=/music,/audiobooksthe root folders have a single path segment. The song list requested/api/songs/music, and Next.js routes a single segment to/api/songs/[id]before the optional catch-all/api/songs/[[...path]]. That route answers400 Invalid song ID, so the list stayed empty and the header showed? files. A subfolder named like a song sub-route had the same problem, e.g./music/audiowent to/api/songs/[id]/audio.The list now sends the folder as a
folderPathquery parameter, the way the adjacent and bulk endpoints already receive it. The route readsfolderPathfirst and still accepts the folder as path segments.Tested
route.test.tswith 4 new tests; all 329 tests pass. ESLint, Prettier and tsc are clean on the changed files (the unusedSongColumnFiltersimport warning inroute.tsis already onmain).MUSIC_FOLDERS=/music,/audiobooks, files directly in/musicand a subfolder/music/audio:/music,/audiobooksand/music/audioreturn400 Invalid song ID./musiclists its 7 songs,/music/audio1,/music/Albums/Amrinder Gill/Judaa3, All Folders 13.musicandaudioshows the songs and the file count.