Skip to content

Commit

Permalink
Fixes go-gitea#14422: Don't use sub-path twice for manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
uli-heller committed Jan 22, 2021
1 parent 1c230f6 commit d7b7484
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ var (
GracefulHammerTime time.Duration
StartupTimeout time.Duration
StaticURLPrefix string
StaticURLPrefixManifest string
AbsoluteAssetURL string

SSH = struct {
Expand Down Expand Up @@ -606,6 +607,11 @@ func NewContext() {
// Suburl should start with '/' and end without '/', such as '/{subpath}'.
// This value is empty if site does not have sub-url.
AppSubURL = strings.TrimSuffix(appURL.Path, "/")
// FIXME: Why does the content of 'StaticURLPrefixManifest' depend on the ordering of
// the next two lines?
// Manifest on top: ""
// Manifest below: "/gitea"
StaticURLPrefixManifest = strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString(""), "/")
StaticURLPrefix = strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString(AppSubURL), "/")
AppSubURLDepth = strings.Count(AppSubURL, "/")
// Check if Domain differs from AppURL domain than update it to AppURL's domain
Expand All @@ -614,7 +620,7 @@ func NewContext() {
Domain = urlHostname
}

AbsoluteAssetURL = MakeAbsoluteAssetURL(AppURL, StaticURLPrefix)
AbsoluteAssetURL = MakeAbsoluteAssetURL(AppURL, StaticURLPrefixManifest)

manifestBytes := MakeManifestData(AppName, AppURL, AbsoluteAssetURL)
ManifestData = `application/json;base64,` + base64.StdEncoding.EncodeToString(manifestBytes)
Expand Down

0 comments on commit d7b7484

Please sign in to comment.