summaryrefslogtreecommitdiffstats
path: root/modules/util
diff options
context:
space:
mode:
authorRowan Bohde <rowan.bohde@gmail.com>2024-11-28 03:50:27 +0100
committerEarl Warren <contact@earl-warren.org>2024-12-03 10:19:22 +0100
commit2e00ae4cddff6ba04fb52adc44b21293857f4267 (patch)
treeba85bf1d629e101311d2122b535e3b4cc951dd90 /modules/util
parentAdd github compatible tarball download API endpoints (#32572) (diff)
downloadforgejo-2e00ae4cddff6ba04fb52adc44b21293857f4267.tar.xz
forgejo-2e00ae4cddff6ba04fb52adc44b21293857f4267.zip
Validate OAuth Redirect URIs (#32643)
This fixes a TODO in the code to validate the RedirectURIs when adding or editing an OAuth application in user settings. This also includes a refactor of the user settings tests to only create the DB once per top-level test to avoid reloading fixtures. (cherry picked from commit 16a7d343d78807e39df124756e5d43a69a2203a3) Conflicts: services/forms/user_form.go tests/integration/user_settings_test.go simple conflicts
Diffstat (limited to 'modules/util')
-rw-r--r--modules/util/truncate.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/util/truncate.go b/modules/util/truncate.go
index 77b116eeff..f2edbdc673 100644
--- a/modules/util/truncate.go
+++ b/modules/util/truncate.go
@@ -41,6 +41,8 @@ func SplitStringAtByteN(input string, n int) (left, right string) {
// SplitTrimSpace splits the string at given separator and trims leading and trailing space
func SplitTrimSpace(input, sep string) []string {
+ // Trim initial leading & trailing space
+ input = strings.TrimSpace(input)
// replace CRLF with LF
input = strings.ReplaceAll(input, "\r\n", "\n")