fix: support closing keywords with URL references #36221
+56
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for closing keywords (
closes,fixes,reopens, etc.) with full URL references in markdown links.Before:
closes #123✅ workscloses org/repo#123✅ worksCloses [this issue](https://gitea.io/user/repo/issues/123)❌ didn't workFixes [#456](https://gitea.io/org/project/issues/456)❌ didn't workAfter:
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:// Note: closing/reopening keywords not supported with URLsBoth 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:
findAllIssueReferencesBytes[text](url), finding the opening bracket[positionTesting
Added test cases for:
Closes [this issue](url)- single URL with closing keywordThis fixes [#456](url)- keyword in middle of textReopens [PR](url)- reopen keyword with pull request URLAll existing tests continue to pass.
Fixes #27549