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:
Deluan 2026-09-01 19:17:03 -04:00
parent 6b88327089
commit fde8a7cd74
2 changed files with 10 additions and 1 deletions

View File

@ -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)"))

View File

@ -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())