No files matched your search
@@ -271,7 +271,7 @@ func respRaw(h http.HandlerFunc) http.Handler {
|
||||
|
||||
type templateData struct {
|
||||
// common
|
||||
Flashes []interface{}
|
||||
Flashes []any
|
||||
User *db.User
|
||||
Version string
|
||||
|
||||
|
||||
@@ -87,7 +87,6 @@ func makeHTTPMockWithAdmin(query url.Values) (*httptest.ResponseRecorder, *http.
|
||||
func runQueryCases(t *testing.T, h handlerSubsonic, cases []*queryCase) {
|
||||
t.Helper()
|
||||
for _, qc := range cases {
|
||||
qc := qc
|
||||
t.Run(qc.expectPath, func(t *testing.T) {
|
||||
t.Helper()
|
||||
t.Parallel()
|
||||
|
||||
@@ -155,11 +155,9 @@ func coverScaleAndSave(reader io.Reader, cachePath string, size int) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("resizing: %w", err)
|
||||
}
|
||||
width := size
|
||||
if width > src.Bounds().Dx() {
|
||||
width := min(size,
|
||||
// don't upscale images
|
||||
width = src.Bounds().Dx()
|
||||
}
|
||||
src.Bounds().Dx())
|
||||
if err := imaging.Save(imaging.Resize(src, width, 0, imaging.Lanczos), cachePath); err != nil {
|
||||
return fmt.Errorf("caching %q: %w", cachePath, err)
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ package params
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"maps"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
@@ -44,9 +45,7 @@ func New(r *http.Request) Params {
|
||||
params := r.URL.Query()
|
||||
// also if there's any in the post body, use those too
|
||||
if err := r.ParseForm(); err == nil {
|
||||
for k, v := range r.Form {
|
||||
params[k] = v
|
||||
}
|
||||
maps.Copy(params, r.Form)
|
||||
}
|
||||
return Params(params)
|
||||
}
|
||||
@@ -389,7 +388,7 @@ func parseTime(in string) (time.Time, error) {
|
||||
return time.Unix(0, ns), nil
|
||||
}
|
||||
|
||||
func parse(values []string, i interface{}) error {
|
||||
func parse(values []string, i any) error {
|
||||
if len(values) == 0 {
|
||||
return ErrNoValues
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ type Error struct {
|
||||
Message string `xml:"message,attr" json:"message"`
|
||||
}
|
||||
|
||||
func NewError(code int, message string, a ...interface{}) *Response {
|
||||
func NewError(code int, message string, a ...any) *Response {
|
||||
r := NewResponse()
|
||||
r.Status = "failed"
|
||||
r.Error = &Error{
|
||||
@@ -128,7 +128,7 @@ type GenreRef struct {
|
||||
// https://opensubsonic.netlify.app/docs/responses/albumid3/
|
||||
type Album struct {
|
||||
ID *specid.ID `xml:"id,attr,omitempty" json:"id"`
|
||||
Created time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
|
||||
Created time.Time `xml:"created,attr,omitempty" json:"created"`
|
||||
|
||||
// legacy or single tag mode
|
||||
ArtistID *specid.ID `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
|
||||
@@ -201,7 +201,7 @@ type TrackChild struct {
|
||||
Bitrate int `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"`
|
||||
ContentType string `xml:"contentType,attr,omitempty" json:"contentType,omitempty"`
|
||||
CoverID *specid.ID `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
|
||||
CreatedAt time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
|
||||
CreatedAt time.Time `xml:"created,attr,omitempty" json:"created"`
|
||||
Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`
|
||||
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
|
||||
Genres []*GenreRef `xml:"genres,omitempty" json:"genres,omitempty"`
|
||||
|
||||
@@ -24,7 +24,6 @@ func TestParseID(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tcase := range tcases {
|
||||
tcase := tcase // pin
|
||||
t.Run(tcase.param, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user