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

Fix manifest encoding #14114

Merged
merged 9 commits into from
Dec 23, 2020
Merged

Fix manifest encoding #14114

merged 9 commits into from
Dec 23, 2020

Conversation

silverwind
Copy link
Member

@silverwind silverwind commented Dec 22, 2020

The previous URL encoding would encode spaces to '+' for the app name (e.g. Gitea:+Git+with+a+cup+of+tea) which is incorrect. Use base64 encoding instead which does not have such issues. Also, use JSON escaping which is sufficient for the data.

@silverwind silverwind added type/bug skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. labels Dec 22, 2020
@silverwind silverwind force-pushed the fix-escape branch 4 times, most recently from ce78fe2 to 40ba741 Compare December 22, 2020 17:03
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Dec 22, 2020
modules/util/util.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Dec 23, 2020
@silverwind
Copy link
Member Author

silverwind commented Dec 23, 2020

Seems Firefox complains about the manifest values as it seems to expect absolute URLs when embedded in a datauri (it accepts relative when a file).

image

@silverwind
Copy link
Member Author

Ok fixed that and Firefox is now satisfied as well.

The previous URL encoding would encode spaces to '+' for the app name
which is incorrect. Use base64 encoding instead which does not have such
issues.
@silverwind
Copy link
Member Author

Seems it does not handle the case of StaticURLPrefix being just a path, fixing it.

@silverwind
Copy link
Member Author

silverwind commented Dec 23, 2020

Added a new setting.AbsoluteAssetURL variable that will hold this absolute path. Previously, we only had it in either relative or absolute form. Also added some tests for the parsing of it and made both functions pure.

@zeripath
Copy link
Contributor

I'm so glad it's not just me that golangci-lint beats around the head...

@silverwind
Copy link
Member Author

silverwind commented Dec 23, 2020

Its insistance on comments is infuriating. Closely followed by it not liking Url or Json capitalization.

@zeripath zeripath merged commit cd5278a into go-gitea:master Dec 23, 2020
@silverwind silverwind deleted the fix-escape branch December 23, 2020 19:14
@go-gitea go-gitea locked and limited conversation to collaborators Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants