From 274961fb96dd5c71ec72a7e4819b1df8484ebbc7 Mon Sep 17 00:00:00 2001 From: ain ghazal Date: Thu, 27 Jun 2024 16:42:57 +0200 Subject: [PATCH] remove unneeded complexity --- internal/oonirun/v2.go | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/internal/oonirun/v2.go b/internal/oonirun/v2.go index 625e44e4b..c2a3ca065 100644 --- a/internal/oonirun/v2.go +++ b/internal/oonirun/v2.go @@ -13,7 +13,6 @@ import ( "fmt" "strings" "sync/atomic" - "unicode" "github.com/hexops/gotextdiff" "github.com/hexops/gotextdiff/myers" @@ -328,21 +327,7 @@ func v2ReadBearerTokenFromFile(fileName string) (string, error) { if scanner.Scan() { line := scanner.Text() - // trim any non printable characters (like control chars) - trimmed := strings.TrimFunc(line, func(r rune) bool { - return !unicode.IsPrint(r) - }) - - // tokenize by whitespace - tokens := strings.Fields(trimmed) - - // return empty string if tokens is empty - if len(tokens) <= 0 { - return "", nil - } - - // ignore all tokens after the first - token := tokens[0] + token := strings.TrimSpace(line) // if this is not a valid base64 token, return empty string if _, err := base64.StdEncoding.DecodeString(token); err != nil {