-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 API raw requests for commits and tags #2841
Fix API raw requests for commits and tags #2841
Conversation
This particular part of the code was broken due to 513375c when the default was set to branch name instead of commit references
Codecov Report
@@ Coverage Diff @@
## master #2841 +/- ##
=======================================
Coverage 26.85% 26.85%
=======================================
Files 89 89
Lines 17607 17607
=======================================
Hits 4728 4728
Misses 12193 12193
Partials 686 686 Continue to review full report at Codecov.
|
modules/context/repo.go
Outdated
@@ -497,6 +500,8 @@ func getRefNameFromPath(ctx *Context, path string, isExist func(string) bool) st | |||
func getRefName(ctx *Context, pathType RepoRefType) string { | |||
path := ctx.Params("*") | |||
switch pathType { | |||
case RepoRefAPI: | |||
fallthrough |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is not this same as case RepoRefLegacy, RepoRefAPI:
? That means you don't need RepoRefAPI
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you do; see line 623
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ethantkoenig Thx, got it. case RepoRefLegacy, RepoRefAPI:
can be used anyway.
Still failed in push tag event.
|
modules/context/repo.go
Outdated
@@ -466,6 +466,9 @@ const ( | |||
// RepoRefLegacy unknown type, make educated guess and redirect. | |||
// for backward compatibility with previous URL scheme | |||
RepoRefLegacy RepoRefType = iota | |||
// RepoRefAPI is for usage in API where educated guess is needed | |||
// but redirect can not be made | |||
RepoRefAPI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rename to make behavior more obvious, perhaps RepoRefAny
?
@Morlinest @ethantkoenig fixed your recommendations |
LGTM |
LGTM |
@appleboy it does work for me (at least when accessing API directly). Added also tests that show that |
@appleboy can you please verify from logs that api/raw url is what is failing? |
@lafriks Still not working in Tag event. |
Fixes #2824
Replaces #2836