commit 1a8f28c

delthas  ·  2025-02-17 14:34:46 +0000 UTC
parent 7ae04de
Avoid considering hash numbers as channels

References like #1234 are much more likely to be references to
ticket numbers than channels.
1 files changed,  +6, -0
+6, -0
 1@@ -120,6 +120,12 @@ func (s StyledString) ParseURLs() StyledString {
 2 				// channel link preceded by a non-space character: eg a#a: drop
 3 				continue
 4 			}
 5+			if !strings.ContainsFunc(link[1:], func(r rune) bool {
 6+				return r < '0' || r > '9'
 7+			}) {
 8+				// channel link with only numbers: eg #1234: drop, because this is likely a reference to a ticket
 9+				continue
10+			}
11 			// store channel in hyperlink params, but create no link.
12 			// this allows us to save the link data without actually creating a link in the terminal
13 			params = fmt.Sprintf("channel=%v", link)