Skip to content

Commit

Permalink
feat: change uploaded filename to uppercase
Browse files Browse the repository at this point in the history
  • Loading branch information
jabuxas committed Oct 31, 2024
1 parent ae81ead commit f2e38fd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"io"
"net/http"
"os"
"strings"

"github.com/golang-jwt/jwt/v5"
)
Expand Down Expand Up @@ -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
}
}

Expand Down

0 comments on commit f2e38fd

Please sign in to comment.