mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-07-22 17:18:33 +00:00
[v11.0/forgejo] fix: pull request cross references (#7983)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/7979 Closes #7974. Co-authored-by: Robert Wolff <mahlzahn@posteo.de> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7983 Reviewed-by: Robert Wolff <mahlzahn@posteo.de> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
parent
55df95b1be
commit
e9f0e96a27
2 changed files with 26 additions and 1 deletions
|
@ -460,7 +460,8 @@ func findAllIssueReferencesBytes(content []byte, links []string) []*rawReference
|
||||||
}
|
}
|
||||||
parts := strings.Split(u.EscapedPath(), "/")
|
parts := strings.Split(u.EscapedPath(), "/")
|
||||||
// /user/repo/issues/3
|
// /user/repo/issues/3
|
||||||
if len(parts) != 5 || parts[0] != "" {
|
// /user/repo/pulls/7/files/...
|
||||||
|
if len(parts) < 5 || parts[0] != "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
var sep string
|
var sep string
|
||||||
|
|
|
@ -132,6 +132,30 @@ func TestFindAllIssueReferences(t *testing.T) {
|
||||||
{203, "user4", "repo5", "203", true, XRefActionNone, nil, nil, ""},
|
{203, "user4", "repo5", "203", true, XRefActionNone, nil, nil, ""},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"This http://gitea.com:3000/user4/repo5/pulls/202#x yes.",
|
||||||
|
[]testResult{
|
||||||
|
{202, "user4", "repo5", "202", true, XRefActionNone, nil, nil, ""},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"This http://gitea.com:3000/user4/repo5/pulls/202/commits yes.",
|
||||||
|
[]testResult{
|
||||||
|
{202, "user4", "repo5", "202", true, XRefActionNone, nil, nil, ""},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"This http://gitea.com:3000/user4/repo5/pulls/202/files yes.",
|
||||||
|
[]testResult{
|
||||||
|
{202, "user4", "repo5", "202", true, XRefActionNone, nil, nil, ""},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"This http://gitea.com:3000/user4/repo5/pulls/202/files#diff- yes.",
|
||||||
|
[]testResult{
|
||||||
|
{202, "user4", "repo5", "202", true, XRefActionNone, nil, nil, ""},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"This http://GiTeA.COM:3000/user4/repo6/pulls/205 yes.",
|
"This http://GiTeA.COM:3000/user4/repo6/pulls/205 yes.",
|
||||||
[]testResult{
|
[]testResult{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue