From f2e38fda23e588769073881db9535773195953a4 Mon Sep 17 00:00:00 2001 From: jabuxas Date: Thu, 31 Oct 2024 10:08:56 -0300 Subject: [PATCH] feat: change uploaded filename to uppercase --- helpers.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/helpers.go b/helpers.go index a1423c8..7a150a0 100644 --- a/helpers.go +++ b/helpers.go @@ -9,6 +9,7 @@ import ( "io" "net/http" "os" + "strings" "github.com/golang-jwt/jwt/v5" ) @@ -73,12 +74,12 @@ func HashFile(file io.Reader, extension string, full bool) (string, error) { return "", err } - sha1Hash := hex.EncodeToString(hasher.Sum(nil)) + sha1Hash := strings.ToUpper(hex.EncodeToString(hasher.Sum(nil))) filename := fmt.Sprintf("%s%s", sha1Hash, extension) if full { return filename, nil } else { - return fmt.Sprintf("%s%s", sha1Hash[:8], extension), nil + return fmt.Sprintf("%s%s", sha1Hash[:5], extension), nil } }