Преглед изворни кода

skip issue index parsing while using external issue tracker

Yoginth пре 7 година
родитељ
комит
e5092cbdba
1 измењених фајлова са 4 додато и 4 уклоњено
  1. 4 4
      models/issue.go

+ 4 - 4
models/issue.go

@@ -813,13 +813,13 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string)
 // 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('#'))
-	if index == 0 {
-		return nil, errors.IssueNotExist{}
+	if n == -1 {
+		return nil, errors.InvalidIssueReference{ref}
 	}
 
 	index := com.StrTo(ref[n+1:]).MustInt64()
-	if err != nil {
-		return nil, err
+	if index == 0 {
+		return nil, errors.IssueNotExist{}
 	}
 
 	repo, err := GetRepositoryByRef(ref[:n])