Skip to content

Commit af339a3

Browse files
Fix markdown links with query parameters (#581)
1 parent 7785aba commit af339a3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

44
# Upcoming
55

6-
### 🔄 Changed
6+
### 🐞 Fixed
7+
- Fix markdown links with query parameters [#581](https://github.com/GetStream/stream-chat-swiftui/pull/581)
78

89
# [4.61.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.61.0)
910
_July 31, 2024_

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ public struct LinkDetectionTextView: View {
327327

328328
let range = NSRange(location: 0, length: message.adjustedText.utf16.count)
329329
linkDetector.links(in: message.adjustedText).forEach { textLink in
330-
let pattern = "\\[([^\\]]+)\\]\\(\(textLink.originalText)\\)"
330+
let escapedOriginalText = NSRegularExpression.escapedPattern(for: textLink.originalText)
331+
let pattern = "\\[([^\\]]+)\\]\\(\(escapedOriginalText)\\)"
331332
if let regex = try? NSRegularExpression(pattern: pattern) {
332333
containsLinks = (regex.firstMatch(
333334
in: message.adjustedText,

0 commit comments

Comments
 (0)