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

Tags with % cause an error #6321

Closed
1 of 3 tasks
jeblair opened this issue Mar 13, 2019 · 6 comments
Closed
1 of 3 tasks

Tags with % cause an error #6321

jeblair opened this issue Mar 13, 2019 · 6 comments
Labels
type/enhancement An improvement of existing functionality
Milestone

Comments

@jeblair
Copy link
Contributor

jeblair commented Mar 13, 2019

  • Gitea version (or commit ref): 91775c1 (latest on try.gitea.io)
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

Git supports "%" in ref names, but Gitea rejects them. In the web UI, creating a tag with the name "debian/1%1.6.0-2" produces the error "TagName must be a well-formed Git reference name." When attempting to push the same tag to a repo, the following error appears:

2019/03/13 18:20:55 [...io/gitea/cmd/hook.go:109 runHookPreReceive()] [F] retrieve protected branches information failed: parse https://localhost:3000/api/internal/branch/620/refs/tags/debian/1%!.(MISSING)0-2: invalid URL escape "%!"(MISSING)

We can confirm that git supports a ref with "%" by either creating a tag with git or running:

git check-ref-format "debian/1%1.6.0-2"

Screenshots

https://screenshots.firefox.com/u1vElZ2A4wLQeXIk/try.gitea.io

@lunny lunny added the type/enhancement An improvement of existing functionality label Mar 14, 2019
@zeripath
Copy link
Contributor

Paging @mrsdizzie - this is another example of bad escaping.

@mrsdizzie
Copy link
Member

This would have at least two separate causes. Not being able to add via the Web interface is because of bad logic here:

// GitRefNamePattern is regular expression with unallowed characters in git reference name
GitRefNamePattern = regexp.MustCompile("[^\\d\\w-_\\./]")

On the command line, I was able to successfully push a tag with the same name as the example above:

https://try.gitea.io/mrsdizzie/parsing-errors/releases

Are you able to replicate not being able to push tags on the command line with try.gitea.org? If so, can you let me know the exact commands for creating and pushing since I wasn't able to reproduce that part just using the name above. I'll start working on a PR for the other part (and this should get a bug tag)

mrsdizzie added a commit to mrsdizzie/gitea that referenced this issue Mar 26, 2019
Clean up checks on reference names to better conform to the guideline
here: https://git-scm.com/docs/git-check-ref-format

This fixes half of go-gitea#6321
@jeblair
Copy link
Contributor Author

jeblair commented Mar 26, 2019 via email

@mrsdizzie
Copy link
Member

Ah OK great, glad that also works for you. The PR I just made will fix the web validation side pending review/approval.

@lafriks lafriks added this to the 1.7.5 milestone Mar 26, 2019
lafriks pushed a commit that referenced this issue Mar 26, 2019
* Clean up ref name rules

Clean up checks on reference names to better conform to the guideline
here: https://git-scm.com/docs/git-check-ref-format

This fixes half of #6321

* Update branch create integration test

According to: https://git-scm.com/docs/git-check-ref-format

And: git check-ref-format "master/feature=test1"

This is a valid branch name and we should not be testing for it to fail.
mrsdizzie added a commit to mrsdizzie/gitea that referenced this issue Mar 26, 2019
* Clean up ref name rules

Clean up checks on reference names to better conform to the guideline
here: https://git-scm.com/docs/git-check-ref-format

This fixes half of go-gitea#6321

* Update branch create integration test

According to: https://git-scm.com/docs/git-check-ref-format

And: git check-ref-format "master/feature=test1"

This is a valid branch name and we should not be testing for it to fail.
mrsdizzie added a commit to mrsdizzie/gitea that referenced this issue Mar 26, 2019
* Clean up ref name rules

Clean up checks on reference names to better conform to the guideline
here: https://git-scm.com/docs/git-check-ref-format

This fixes half of go-gitea#6321

* Update branch create integration test

According to: https://git-scm.com/docs/git-check-ref-format

And: git check-ref-format "master/feature=test1"

This is a valid branch name and we should not be testing for it to fail.
@mrsdizzie
Copy link
Member

This can be closed per d056bf3

@zeripath
Copy link
Contributor

Fixed by #6437 and #6304

@lafriks lafriks modified the milestones: 1.7.5, 1.8.0 Mar 27, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement An improvement of existing functionality
Projects
None yet
Development

No branches or pull requests

5 participants