fix: address code review findings

- notifier: show artist display names (not internal IDs) in digest; resolve
  names from artist_settings and fall back to ID when unavailable
- notifier: skip sending an empty digest to avoid daily spam
- config: require telegram token/chat_id when enabled
- web: warn loudly when auth is disabled on a non-loopback bind; add HTTP
  server timeouts
- web: treat SetReleaseIgnored "release not found" as benign redirect (0 rows)
- musicbrainz: reject low-score/name-mismatched MBID resolutions instead of
  silently caching the wrong artist
- database: remove dead duplicate err check; harden DSN param appending
- musicbrainz: check rows.Err() after iterating existing releases
This commit is contained in:
2026-07-19 23:46:05 +03:00
parent 389d177d85
commit 7cdb473d9c
12 changed files with 189 additions and 22 deletions

View File

@@ -3,6 +3,7 @@ package web
import (
"context"
"embed"
"errors"
"fmt"
"html/template"
"net/http"
@@ -238,6 +239,14 @@ func (s *Server) ignoreOrRestore(w http.ResponseWriter, r *http.Request) {
ignored := action == "ignore"
if err := database.SetReleaseIgnored(s.db, rgid, ignored); err != nil {
// A 0-rows-affected error means the release was already removed by a
// concurrent re-sync (it disappeared from MusicBrainz). That is benign:
// redirect back rather than surfacing a 500 for a now-nonexistent row.
var notFoundErr error = database.ErrReleaseNotFound
if errors.Is(err, notFoundErr) {
http.Redirect(w, r, "/artist/"+id, http.StatusSeeOther)
return
}
http.Error(w, fmt.Sprintf("failed to set ignored: %v", err), http.StatusInternalServerError)
return
}