From 3990c3c5b74f7ec5607b47bb16ba6821fb94dc27 Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Fri, 23 Jul 2021 11:21:05 +0200 Subject: [PATCH] gofmt --- server/handlers.go | 16 ++++++++-------- server/utils.go | 5 ++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/server/handlers.go b/server/handlers.go index 7dad2fc..4947b77 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -249,14 +249,14 @@ func (s *Server) viewHandler(w http.ResponseWriter, r *http.Request) { } data := struct { - Hostname string - WebAddress string - GAKey string - UserVoiceKey string - PurgeTime string + Hostname string + WebAddress string + GAKey string + UserVoiceKey string + PurgeTime string MaxUploadSize string - SampleToken string - SampleToken2 string + SampleToken string + SampleToken2 string }{ hostname, webAddress, @@ -1043,7 +1043,7 @@ func (s *Server) getHandler(w http.ResponseWriter, r *http.Request) { reader = ioutil.NopCloser(bluemonday.UGCPolicy().SanitizeReader(reader)) } - if w.Header().Get("Range") != "" || strings.HasPrefix(metadata.ContentType, "video") || strings.HasPrefix(metadata.ContentType, "audio") { + if w.Header().Get("Range") != "" || strings.HasPrefix(metadata.ContentType, "video") || strings.HasPrefix(metadata.ContentType, "audio") { file, err := ioutil.TempFile(s.tempPath, "range-") if err != nil { s.logger.Printf("%s", err.Error()) diff --git a/server/utils.go b/server/utils.go index d457916..3a53adc 100644 --- a/server/utils.go +++ b/server/utils.go @@ -258,9 +258,9 @@ func acceptsHTML(hdr http.Header) bool { func formatSize(size int64) string { sizeFloat := float64(size) - base := math.Log(sizeFloat)/math.Log(1024) + base := math.Log(sizeFloat) / math.Log(1024) - sizeOn := math.Pow(1024, base - math.Floor(base)) + sizeOn := math.Pow(1024, base-math.Floor(base)) var round float64 pow := math.Pow(10, float64(2)) @@ -276,7 +276,6 @@ func formatSize(size int64) string { suffixes[3] = "GB" suffixes[4] = "TB" - getSuffix := suffixes[int(math.Floor(base))] return fmt.Sprintf("%s %s", strconv.FormatFloat(newVal, 'f', -1, 64), getSuffix) }