mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-19 07:30:50 +00:00
fix: pull request cross references (#7979)
Closes #7974. ### Tests - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I added test coverage for JavaScript changes... - [ ] in `web_src/js/*.test.js` if it can be unit tested. - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [ ] I do not want this change to show in the release notes. - [x] I want the title to show in the release notes with a link to this pull request. - [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7979 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Robert Wolff <mahlzahn@posteo.de> Co-committed-by: Robert Wolff <mahlzahn@posteo.de>
This commit is contained in:
parent
7d2a7b8559
commit
e78d1c8210
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