refactor(artwork): use the shared httpclient for image downloads

Same behavior: httpclient.New sets the Navidrome User-Agent via its
transport, so the manual header is no longer needed.
This commit is contained in:
Deluan 2026-08-26 10:53:07 -04:00
parent f08b5297ee
commit a9962ebe5d

View File

@ -16,10 +16,10 @@ import (
"strings"
"time"
"github.com/navidrome/navidrome/consts"
"github.com/navidrome/navidrome/core/ffmpeg"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/utils/httpclient"
"go.senan.xyz/taglib"
)
@ -163,9 +163,8 @@ type readCloser struct {
}
func fromURL(ctx context.Context, imageUrl *url.URL) (io.ReadCloser, string, error) {
hc := http.Client{Timeout: 5 * time.Second}
hc := httpclient.New(5 * time.Second)
req, _ := http.NewRequestWithContext(ctx, http.MethodGet, imageUrl.String(), nil)
req.Header.Set("User-Agent", consts.HTTPUserAgent)
resp, err := hc.Do(req) //nolint:gosec
if err != nil {
return nil, "", err