mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-18 07:30:29 +00:00
fix(artwork): name failed among the sources a typo error suggests
The suggestion list is built from the sources actually in use, and failed is never stored as one, so rejecting `--source faild` listed every valid value except the one this PR added. Found by typo'ing it against a running server while checking the rest of the command.
This commit is contained in:
parent
6b88327089
commit
fde8a7cd74
@ -464,7 +464,8 @@ func validateSources(q model.ArtworkQueueRepository, sources []string) error {
|
||||
if len(unknown) == 0 {
|
||||
return nil
|
||||
}
|
||||
valid := slice.Map(inUse, displaySource)
|
||||
// failed is accepted but never stored, so listing only what is in use would hide it.
|
||||
valid := append(slice.Map(inUse, displaySource), failedSource)
|
||||
slices.Sort(valid)
|
||||
return fmt.Errorf("no artwork resolves from %s; sources in use: %s",
|
||||
strings.Join(unknown, ", "), cmp.Or(strings.Join(valid, ", "), "(none)"))
|
||||
|
||||
@ -783,6 +783,14 @@ var _ = Describe("reprocessArtwork", func() {
|
||||
imageAgents, true, accept, &out)).ToNot(Succeed(), "a typo must still be rejected")
|
||||
})
|
||||
|
||||
It("names failed among the valid sources when rejecting a typo", func() {
|
||||
err := reprocessArtwork(ctx, ds, kinds, []string{"faild"}, imageAgents, true, accept, &out)
|
||||
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(err.Error()).To(ContainSubstring("failed"),
|
||||
"failed is accepted but never stored, so it has to be named explicitly")
|
||||
})
|
||||
|
||||
It("accepts a source another kind uses, letting the empty selection report itself", func() {
|
||||
Expect(reprocessArtwork(ctx, ds, []model.Kind{model.KindArtistArtwork}, []string{"folder"},
|
||||
imageAgents, false, decline, &out)).To(Succeed())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user