Skip to content

Commit 2ca4ef2

Browse files
committed
Plugins: fix monotree repo ref from gui/#123 to gui#123
1 parent 9c9ba18 commit 2ca4ef2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

_plugins/githubify.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@ def render(context)
2626
## Convert #1234 into URL for the pull request
2727
## If #1234 links to an issue, GitHub automatically redirects
2828
#
29-
## Main repository; forbid prefix of "/" to avoid conflation with
29+
## Main repository; forbid any lowercase alphabetical prefix to avoid conflation with
3030
## other monotree repos like bitcoin-core/gui. Require at least a
3131
## double-digit number to reduce false positive matches (e.g. "fix thing,
3232
## try #2")
33-
output.gsub!(/(^|[^\/])#([0-9]+)/){ |s|
33+
output.gsub!(/(^|[^a-z])#([0-9][0-9]+)/){ |s|
3434
$1 + '<a href="' + @repository_url + '/pull/' + $2 + '">#' + $2 + '</a>'
3535
}
3636

37-
## Other monotree repos; for repo "bitcoin-core/foo", PR format is "foo/#123"
38-
output.gsub!(/([a-z]+)\/#([0-9]+)/){ |s|
37+
## Other monotree repos; for repo "bitcoin-core/foo", PR format is "foo#123".
38+
## Must start at word boundary
39+
output.gsub!(/\b([a-z]+)#([0-9]+)/){ |s|
3940
'<a href="https://github.com/bitcoin-core/' + $1 + '/pull/' + $2 + '">' + s + '</a>'
4041
}
4142

0 commit comments

Comments
 (0)