mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Fix url replacement for links with no scheme
This commit is contained in:
parent
be625b693c
commit
b7ef87031d
1 changed files with 3 additions and 4 deletions
|
|
@ -27,10 +27,9 @@ func generateMessageMarkdown (message: String) -> String {
|
|||
let phone = messageWithMarkdown[range]
|
||||
messageWithMarkdown = messageWithMarkdown.replacingOccurrences(of: phone, with: "[\(phone)](tel:\(phone))")
|
||||
} else if match.resultType == .link {
|
||||
let url = match.url?.absoluteString ?? ""
|
||||
if url.count > 0 {
|
||||
messageWithMarkdown = messageWithMarkdown.replacingOccurrences(of: url, with: "[\(String(match.url?.host ?? "Link"))\(String(match.url?.path ?? ""))](\(url))")
|
||||
}
|
||||
let url = messageWithMarkdown[range]
|
||||
let absoluteUrl = match.url?.absoluteString ?? ""
|
||||
messageWithMarkdown = messageWithMarkdown.replacingOccurrences(of: url, with: "[\(String(match.url?.host ?? "Link"))\(String(match.url?.path ?? ""))](\(absoluteUrl))")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue