From 194ed7d6666fd50283a24b94bc18a483a328aff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 1 Jul 2024 13:07:00 +0200 Subject: Fix remaining lints --- object.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'object.go') diff --git a/object.go b/object.go index 6e0dc92..b32c412 100644 --- a/object.go +++ b/object.go @@ -669,11 +669,12 @@ func (o *Object) TempURL(key, method string, expires time.Time) (string, error) allowedDigest := capabilities.TempURL.AllowedDigests var mac hash.Hash - if contains(allowedDigest, "sha256") { + switch { + case contains(allowedDigest, "sha256"): mac = hmac.New(sha256.New, []byte(key)) - } else if contains(allowedDigest, "sha1") { + case contains(allowedDigest, "sha1"): mac = hmac.New(sha1.New, []byte(key)) - } else { + default: return "", fmt.Errorf("schwift supports sha1 and sha256 digests but the Swift server only supports: %s", strings.Join(allowedDigest, ", ")) } -- cgit v1.2.3