Skip to content

Commit 1947a48

Browse files
wxiaoguangdenyskon
andauthored
Apply suggestions from code review
Co-authored-by: Denys Konovalov <[email protected]>
1 parent 493f304 commit 1947a48

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

modules/httplib/url_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func TestGuessCurrentHostURL(t *testing.T) {
5050

5151
assert.Equal(t, "http://cfg-host", GuessCurrentHostURL(t.Context()))
5252

53-
// legacy: the "Host" is not used when there is no "X-Forwarded-Proto" header
53+
// legacy: "Host" is not used when there is no "X-Forwarded-Proto" header
5454
ctx := context.WithValue(t.Context(), RequestContextKey, &http.Request{Host: "req-host:3000"})
5555
assert.Equal(t, "http://cfg-host", GuessCurrentHostURL(ctx))
5656

modules/setting/server.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ var (
5252
// It maps to ini:"ROOT_URL"
5353
AppURL string
5454

55-
// PublicURLGeneration controls how to use the HTTP request headers to generate public URL
56-
PublicURLGeneration string
55+
// PublicURLDetection controls how to use the HTTP request headers to detect public URL
56+
PublicURLDetection string
5757

5858
// AppSubURL represents the sub-url mounting point for gitea, parsed from "ROOT_URL"
5959
// It is either "" or starts with '/' and ends without '/', such as '/{sub-path}'.
@@ -289,9 +289,9 @@ func loadServerFrom(rootCfg ConfigProvider) {
289289

290290
defaultAppURL := string(Protocol) + "://" + Domain + ":" + HTTPPort
291291
AppURL = sec.Key("ROOT_URL").MustString(defaultAppURL)
292-
PublicURLGeneration = sec.Key("PUBLIC_URL_DETECTION").MustString(PublicURLLegacy)
293-
if PublicURLGeneration != PublicURLAuto && PublicURLGeneration != PublicURLLegacy {
294-
log.Fatal("Invalid PUBLIC_URL_DETECTION value: %s", PublicURLGeneration)
292+
PublicURLDetection = sec.Key("PUBLIC_URL_DETECTION").MustString(PublicURLLegacy)
293+
if PublicURLDetection != PublicURLAuto && PublicURLDetection != PublicURLLegacy {
294+
log.Fatal("Invalid PUBLIC_URL_DETECTION value: %s", PublicURLDetection)
295295
}
296296

297297
// Check validity of AppURL

0 commit comments

Comments
 (0)