Skip to content

Commit 37bd295

Browse files
committed
Ensure that setting.LocalURL always has a trailing slash (go-gitea#19171)
Backport go-gitea#19171 Fix go-gitea#19166 Signed-off-by: Andrew Thornton <art27@cantab.net>
1 parent 23b8214 commit 37bd295

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/setting/setting.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,15 @@ var (
9292
// AppDataPath is the default path for storing data.
9393
// It maps to ini:"APP_DATA_PATH" and defaults to AppWorkPath + "/data"
9494
AppDataPath string
95+
// LocalURL is the url for locally running applications to contact Gitea. It always has a '/' suffix
96+
// It maps to ini:"LOCAL_ROOT_URL"
97+
LocalURL string
9598

9699
// Server settings
97100
Protocol Scheme
98101
Domain string
99102
HTTPAddr string
100103
HTTPPort string
101-
LocalURL string
102104
RedirectOtherPort bool
103105
PortToRedirect string
104106
OfflineMode bool
@@ -712,6 +714,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
712714
}
713715
}
714716
LocalURL = sec.Key("LOCAL_ROOT_URL").MustString(defaultLocalURL)
717+
LocalURL = strings.TrimRight(LocalURL, "/") + "/"
715718
RedirectOtherPort = sec.Key("REDIRECT_OTHER_PORT").MustBool(false)
716719
PortToRedirect = sec.Key("PORT_TO_REDIRECT").MustString("80")
717720
OfflineMode = sec.Key("OFFLINE_MODE").MustBool()

0 commit comments

Comments
 (0)