-
-
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
// RepoRefBranch branch | ||
RepoRefBranch | ||
// RepoRefTag tag | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Is not this same as There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. @ethantkoenig Thx, got it. |
||
case RepoRefLegacy: | ||
if refName := getRefName(ctx, RepoRefBranch); len(refName) > 0 { | ||
return refName | ||
|
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
?