aboutsummaryrefslogtreecommitdiffstats
path: root/modules/setting
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-05-20 17:16:06 +0100
committerGitHub <noreply@github.com>2020-05-20 19:16:06 +0300
commitc81ab17de93ee14268ad2088d1b63e0162e3dd23 (patch)
tree5c6f9af4f8b9c1e4597807772a6788781dcfc96f /modules/setting
parent0903b1ac8c7b64bb571d02cdd69fa671cc1c18c1 (diff)
downloadgitea-c81ab17de93ee14268ad2088d1b63e0162e3dd23.tar.gz
gitea-c81ab17de93ee14268ad2088d1b63e0162e3dd23.zip
TrimSpace when reading InternalToken from a file (#11502)
InternalTokens are fixed as alphanum strings therefore TrimSpace from these. Also use isatty to not add a terminal newline when redirecting generate. Fix #11498 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'modules/setting')
-rw-r--r--modules/setting/setting.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index ede4687c81..9507d46930 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -1069,7 +1069,7 @@ func loadInternalToken(sec *ini.Section) string {
return token
}
- return string(buf)
+ return strings.TrimSpace(string(buf))
default:
log.Fatal("Unsupported URI-Scheme %q (INTERNAL_TOKEN_URI = %q)", tempURI.Scheme, uri)
}