fix(musicbrainz): follow the redirect of an id that was merged

When MusicBrainz merges two entries, the old id answers with a redirect to the new one. The client refused every redirect, so the description of that artist failed at every run of the job.

The client for MusicBrainz now follows a redirect only to https://musicbrainz.org/ws/2/artist/<id> or /release-group/<id>, with no credentials or port. Any other redirect is still refused. The new id is used for that request only.
This commit is contained in:
tgiachi 2026-11-12 19:34:59 +01:00
commit 6b40ea06fa

View file

@ -155,8 +155,9 @@ func run() error {
// MusicBrainz wants a contact in the User-Agent, which an admin can change: it
// is read again for every request.
musicbrainzClient := musicbrainz.New(outbound.New(outbound.Options{
UserAgentFunc: providerSettings.UserAgentFor(providers.MusicBrainz, version),
MinInterval: musicbrainzMinInterval,
UserAgentFunc: providerSettings.UserAgentFor(providers.MusicBrainz, version),
MinInterval: musicbrainzMinInterval,
FollowRedirect: musicbrainz.RedirectAllowed, // an id that was merged leads to the new one, and to nothing else
}), musicbrainz.BaseURL)
providerSettings.SetChecker(providers.MusicBrainz, func(ctx context.Context, _ string) error {
return musicbrainzClient.Probe(ctx)