mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 16:13:42 +02:00
Fix render of links with both characters requiring percent encoding and markdown-like syntax
This commit is contained in:
@@ -166,10 +166,11 @@ private extension CMarkNode {
|
||||
private extension String {
|
||||
/// Returns array of URLs detected inside the String.
|
||||
var containedUrls: [NSTextCheckingResult] {
|
||||
guard let detector = try? NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue) else {
|
||||
guard let detector = try? NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue),
|
||||
let percentEncoded = self.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) else {
|
||||
return []
|
||||
}
|
||||
|
||||
return detector.matches(in: self, options: [], range: NSRange(location: 0, length: self.utf16.count))
|
||||
return detector.matches(in: percentEncoded, options: [], range: NSRange(location: 0, length: percentEncoded.utf16.count))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user