Skip to content

Commit 461068c

Browse files
authored
Ensure that setting.LocalURL always has a trailing slash (#19171)
Fix #19166 Signed-off-by: Andrew Thornton <art27@cantab.net>
1 parent 7a550b3 commit 461068c

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
@@ -89,13 +89,15 @@ var (
8989
// AppDataPath is the default path for storing data.
9090
// It maps to ini:"APP_DATA_PATH" and defaults to AppWorkPath + "/data"
9191
AppDataPath string
92+
// LocalURL is the url for locally running applications to contact Gitea. It always has a '/' suffix
93+
// It maps to ini:"LOCAL_ROOT_URL"
94+
LocalURL string
9295

9396
// Server settings
9497
Protocol Scheme
9598
Domain string
9699
HTTPAddr string
97100
HTTPPort string
98-
LocalURL string
99101
RedirectOtherPort bool
100102
PortToRedirect string
101103
OfflineMode bool
@@ -747,6 +749,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
747749
}
748750
}
749751
LocalURL = sec.Key("LOCAL_ROOT_URL").MustString(defaultLocalURL)
752+
LocalURL = strings.TrimRight(LocalURL, "/") + "/"
750753
RedirectOtherPort = sec.Key("REDIRECT_OTHER_PORT").MustBool(false)
751754
PortToRedirect = sec.Key("PORT_TO_REDIRECT").MustString("80")
752755
OfflineMode = sec.Key("OFFLINE_MODE").MustBool()

0 commit comments

Comments
 (0)