mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-27 21:07:44 +00:00
## Summary This PR adds support for closing keywords (`closes`, `fixes`, `reopens`, etc.) with full URL references in markdown links. **Before:** - `closes #123` ✅ works - `closes org/repo#123` ✅ works - `Closes [this issue](https://gitea.io/user/repo/issues/123)` ❌ didn't work - `Fixes [#456](https://gitea.io/org/project/issues/456)` ❌ didn't work **After:** All of the above now work correctly. ## Problem When users reference issues using full URLs in markdown links (e.g., `Closes [this issue](https://gitea.io/user/repo/issues/123)`), the closing keywords were not detected. This was because the URL processing code explicitly stated: ```go // Note: closing/reopening keywords not supported with URLs ``` Both methods of writing the reference render the same in the UI, so users expected the closing keywords to behave the same. ## Solution The fix works by: 1. Passing the original (unstripped) content to `findAllIssueReferencesBytes` 2. When processing URL links from markdown, finding the URL position in the original content 3. For markdown links `[text](url)`, finding the opening bracket `[` position 4. Using that position to detect closing keywords before the link ## Testing Added test cases for: - `Closes [this issue](url)` - single URL with closing keyword - `This fixes [#456](url)` - keyword in middle of text - `Reopens [PR](url)` - reopen keyword with pull request URL - Multiple URLs where only one has a closing keyword All existing tests continue to pass. Fixes #27549 |
||
|---|---|---|
| .. | ||
| references_test.go | ||
| references.go | ||