mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-31 07:30:32 +00:00
* feat(artwork): make the artwork image size cap configurable Replace the hardcoded 20MB cap on resolved image reads with a new MaxImageSize config option. Load floors it at MaxImageUploadSize so an accepted upload can never be too large for the resolver to read back. * fix(conf): reject zero-valued byte-size options at startup ParseBytes accepts "0", but parseSize silently substitutes the default for it, so the accepted config would differ from the effective limit. * fix(conf): reject byte-size options that overflow int64 A raw value above math.MaxInt64 parses as a valid uint64 but wraps to a negative int64 in parseSize, giving readCapped a non-positive LimitReader bound so every artwork read comes back empty.
39 lines
741 B
Go
39 lines
741 B
Go
package conf
|
|
|
|
func ResetConf() {
|
|
Server = &configOptions{}
|
|
}
|
|
|
|
var SetViperDefaults = setViperDefaults
|
|
|
|
var ParseLanguages = parseLanguages
|
|
|
|
var ValidateURL = validateURL
|
|
|
|
var NormalizeSearchBackend = normalizeSearchBackend
|
|
|
|
var ToPascalCase = toPascalCase
|
|
|
|
var ValidateByteSize = validateByteSize
|
|
|
|
func SetRuntimeInfoForTest(goos string, euid int) func() {
|
|
oldGOOS := currentGOOS
|
|
oldEUID := getEUID
|
|
currentGOOS = func() string { return goos }
|
|
getEUID = func() int { return euid }
|
|
return func() {
|
|
currentGOOS = oldGOOS
|
|
getEUID = oldEUID
|
|
}
|
|
}
|
|
|
|
func SetLogFatal(f func(...any)) func() {
|
|
old := logFatal
|
|
logFatal = f
|
|
return func() { logFatal = old }
|
|
}
|
|
|
|
var UnknownConfigKeys = unknownConfigKeys
|
|
|
|
var SuggestOptions = suggestOptions
|