forked from forgejo/forgejo
#1545 prevent duplicated refs of issues in single commit
This commit is contained in:
parent
1fd5f8edf8
commit
b6131793da
3 changed files with 51 additions and 88 deletions
|
@ -1105,15 +1105,12 @@ func DeleteRepository(uid, repoID int64) error {
|
|||
// See https://help.github.com/articles/writing-on-github#references for more information on the syntax.
|
||||
func GetRepositoryByRef(ref string) (*Repository, error) {
|
||||
n := strings.IndexByte(ref, byte('/'))
|
||||
|
||||
if n < 2 {
|
||||
return nil, ErrInvalidReference
|
||||
}
|
||||
|
||||
userName, repoName := ref[:n], ref[n+1:]
|
||||
|
||||
user, err := GetUserByName(userName)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue