Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use sub-path twice for manifest #14427

Closed
wants to merge 4 commits into from

Conversation

uli-heller
Copy link
Contributor

@uli-heller uli-heller commented Jan 22, 2021

Fixes #14422

@techknowlogick techknowlogick changed the title Fixes #14422: Don't use sub-path twice for manifest Don't use sub-path twice for manifest Jan 22, 2021
@6543 6543 added the type/bug label Jan 22, 2021
@6543 6543 added this to the 1.14.0 milestone Jan 22, 2021
@techknowlogick
Copy link
Member

Thanks for this PR!

It is failing on the CI due to needing to run make fmt on your local working copy and pushing the results of that.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 22, 2021
GracefulHammerTime time.Duration
StartupTimeout time.Duration
StaticURLPrefix string
StaticURLPrefixManifest string
Copy link
Member

@6543 6543 Jan 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, adding a special var only for manifest is the right way to fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to change it! I do not know anything about go and my heart isn't connected with this pull request. All I know is that it fixes the issue for me. And I know it is not very nicely done. So: You surely don't offend me if you fix it differently

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First thanks for the pull, I think we can evolve your pull ;) together ...

@6543
Copy link
Member

6543 commented Jan 24, 2021

I would wait until #14293 got merged ...

@uli-heller
Copy link
Contributor Author

Does someone know why the fix only works when using this ordering:

// OK - manifest contains correct urls
AbsoluteAssetURL = MakeAbsoluteAssetURL(AppURL, strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString(""), "/"))
StaticURLPrefix = strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString(AppSubURL), "/")

When I change the ordering, the manifest contains the wrong urls, those based on StaticURLPrefix:

// KO - manifest contains wrong urls based on StaticURLPrefix
StaticURLPrefix = strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString(AppSubURL), "/")
AbsoluteAssetURL = MakeAbsoluteAssetURL(AppURL, strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString(""), "/"))

@silverwind
Copy link
Member

silverwind commented Jan 29, 2021

Hmm if this is really fixed by reordering statements, there must be another underlying issue that causes the variable to go wrong somewhere else. It must only be assigned once.

@uli-heller
Copy link
Contributor Author

Sorry, maybe my explanation is misleading.

The issue is caused by this:

StaticURLPrefix = strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString(AppSubURL), "/")

It makes "StaticURLPrefix" an URL that contains the sub-path twice, i.e. "https://mygitea.tld/gitea/gitea".
strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString(""), "/") fixes this.

But only it is it called before StaticURLPrefix=strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString("AppSubURL"), "/"). Currently, I don't understand why it has to be called first...

@6543
Copy link
Member

6543 commented Feb 11, 2021

could be #12999 an alternative for this pull?!?

@uli-heller
Copy link
Contributor Author

@6543 : Shall I give it - #12999 - a try and report if it fixes the issue?

@6543
Copy link
Member

6543 commented Feb 12, 2021

@uli-heller would be nice

@uli-heller
Copy link
Contributor Author

@6543 : Merging worked without an issue, building too. Unfortuntely, the issue is not fixed by #12999:
image

@6543
Copy link
Member

6543 commented Feb 28, 2021

thanks for your work & testing.

I'll close this since #14827 did catch the real issue behind it :)

@6543 6543 closed this Feb 28, 2021
@6543 6543 removed this from the 1.14.0 milestone Feb 28, 2021
@uli-heller
Copy link
Contributor Author

@6543 : Thx a lot!

@go-gitea go-gitea locked and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chrome tries to load .../gitea/gitea/img/logo.png, Firefox loads .../gitea/img/logo.png
5 participants