mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Remove GetRepositoryByRef and add GetRepositoryByOwnerAndName (#3043)
* remove GetRepositoryByRef and add GetRepositoryByOwnerAndName * fix tests * fix tests bug * some improvements
This commit is contained in:
@@ -964,7 +964,7 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string)
|
||||
// GetIssueByRef returns an Issue specified by a GFM reference.
|
||||
// See https://help.github.com/articles/writing-on-github#references for more information on the syntax.
|
||||
func GetIssueByRef(ref string) (*Issue, error) {
|
||||
n := strings.IndexByte(ref, byte('#'))
|
||||
n := strings.IndexByte(ref, '#')
|
||||
if n == -1 {
|
||||
return nil, errMissingIssueNumber
|
||||
}
|
||||
@@ -974,7 +974,12 @@ func GetIssueByRef(ref string) (*Issue, error) {
|
||||
return nil, errInvalidIssueNumber
|
||||
}
|
||||
|
||||
repo, err := GetRepositoryByRef(ref[:n])
|
||||
i := strings.IndexByte(ref[:n], '/')
|
||||
if i < 2 {
|
||||
return nil, ErrInvalidReference
|
||||
}
|
||||
|
||||
repo, err := GetRepositoryByOwnerAndName(ref[:i], ref[i+1:n])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user