mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-31 07:30:32 +00:00
fix: prevent remapping from dropping participants on target track
This commit is contained in:
parent
fd11269b61
commit
03c9784605
@ -67,7 +67,7 @@ func (s *maintenanceService) RemapMissingFile(ctx context.Context, missingID, ta
|
||||
return fmt.Errorf("%w: %q", ErrNotMissing, missingID)
|
||||
}
|
||||
|
||||
target, err := s.ds.MediaFile(ctx).Get(targetID)
|
||||
target, err := s.ds.MediaFile(ctx).GetWithParticipants(targetID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("loading target file %q: %w", targetID, err)
|
||||
}
|
||||
|
||||
@ -335,6 +335,25 @@ var _ = Describe("Maintenance", func() {
|
||||
|
||||
Expect(service.RemapMissingFile(ctx, "m1", "t1")).To(MatchError(ContainSubstring("gc failed")))
|
||||
})
|
||||
|
||||
It("preserves the target's participants on the remapped track", func() {
|
||||
participant := model.Participant{
|
||||
Artist: model.Artist{ID: "a1", Name: "Artist", OrderArtistName: "artist", MbzArtistID: "mbz-artist"},
|
||||
}
|
||||
mfRepo.SetData(model.MediaFiles{
|
||||
{ID: "m1", AlbumID: "album1", Missing: true},
|
||||
{ID: "t1", AlbumID: "album2", Missing: false, Participants: model.Participants{
|
||||
model.RoleArtist: model.ParticipantList{participant},
|
||||
}},
|
||||
})
|
||||
|
||||
Expect(service.RemapMissingFile(ctx, "m1", "t1")).To(Succeed())
|
||||
|
||||
// The surviving row is the missing file's ID, holding the target's data
|
||||
got, err := mfRepo.GetWithParticipants("m1")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(got.Participants).To(HaveKeyWithValue(model.RoleArtist, model.ParticipantList{participant}))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user