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
jeblair opened this issue Mar 13, 2019 · 6 comments

Comments

5 participants
@jeblair
Copy link
Contributor

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

@zeripath

This comment has been minimized.

Copy link
Contributor

commented Mar 15, 2019

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

@zeripath zeripath referenced this issue Mar 25, 2019

Open

Not all new git tags are listed as release #6237

1 of 7 tasks complete
@mrsdizzie

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

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 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
@jeblair

This comment has been minimized.

Copy link
Contributor Author

commented Mar 26, 2019

@mrsdizzie

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

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 added a commit that referenced this issue Mar 26, 2019

Clean up ref name rules (#6437)
* 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 (go-gitea#6437)
* 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 (go-gitea#6437)
* 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

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

This can be closed per d056bf3

@zeripath

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

Fixed by #6437 and #6304

@zeripath zeripath closed this Mar 26, 2019

@lafriks lafriks modified the milestones: 1.7.5, 1.8.0 Mar 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.