aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-03-22 16:59:57 +0000
committerGitHub <noreply@github.com>2022-03-22 16:59:57 +0000
commit461068cfa14bce6c1d6e24a6dc84b7ea0ac60080 (patch)
treecdd41e5587eaa6c119bd1edceac418f4a31743a4 /modules
parent7a550b3af20dad94cf468012a6b817b43b91c1ba (diff)
downloadgitea-461068cfa14bce6c1d6e24a6dc84b7ea0ac60080.tar.gz
gitea-461068cfa14bce6c1d6e24a6dc84b7ea0ac60080.zip
Ensure that setting.LocalURL always has a trailing slash (#19171)
Fix #19166 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules')
-rw-r--r--modules/setting/setting.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 2a189ec9b3..d11f3e65eb 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -89,13 +89,15 @@ var (
// AppDataPath is the default path for storing data.
// It maps to ini:"APP_DATA_PATH" and defaults to AppWorkPath + "/data"
AppDataPath string
+ // LocalURL is the url for locally running applications to contact Gitea. It always has a '/' suffix
+ // It maps to ini:"LOCAL_ROOT_URL"
+ LocalURL string
// Server settings
Protocol Scheme
Domain string
HTTPAddr string
HTTPPort string
- LocalURL string
RedirectOtherPort bool
PortToRedirect string
OfflineMode bool
@@ -747,6 +749,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
}
}
LocalURL = sec.Key("LOCAL_ROOT_URL").MustString(defaultLocalURL)
+ LocalURL = strings.TrimRight(LocalURL, "/") + "/"
RedirectOtherPort = sec.Key("REDIRECT_OTHER_PORT").MustBool(false)
PortToRedirect = sec.Key("PORT_TO_REDIRECT").MustString("80")
OfflineMode = sec.Key("OFFLINE_MODE").MustBool()