diff --git a/model/id/id.go b/model/id/id.go index 61dc8d443..1588f38c3 100644 --- a/model/id/id.go +++ b/model/id/id.go @@ -6,6 +6,8 @@ import ( "fmt" "math/big" "strings" + + "github.com/navidrome/navidrome/log" ) func NewRandom() string { @@ -17,7 +19,7 @@ func NewRandom() string { // Encode128 renders a 16-byte value as the canonical 22-char zero-padded base62 id. func Encode128(b []byte) string { if len(b) != 16 { - panic(fmt.Sprintf("id.Encode128: expected 16 bytes, got %d", len(b))) + log.Fatal("Encode128: expected 16 bytes", "got", len(b)) } return fmt.Sprintf("%022s", new(big.Int).SetBytes(b).Text(62)) } diff --git a/model/id/id_test.go b/model/id/id_test.go index d3858af6b..fc311016c 100644 --- a/model/id/id_test.go +++ b/model/id/id_test.go @@ -22,10 +22,6 @@ var _ = Describe("Encode128/Decode128", func() { Expect(id.Decode128(s)).To(Equal(b)) }) - It("panics on non-16-byte input", func() { - Expect(func() { id.Encode128(make([]byte, 15)) }).To(Panic()) - }) - It("rejects invalid input", func() { _, err := id.Decode128("short") Expect(err).To(HaveOccurred())