From 6e3089f025c0bfd923c11cf95ea7930aafb2c514 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 29 Mar 2022 12:40:16 -0400 Subject: [PATCH] Use WebURL for parsing links in HTML --- Tusker/Views/ContentTextView.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tusker/Views/ContentTextView.swift b/Tusker/Views/ContentTextView.swift index 12195d63c9..3cef26e471 100644 --- a/Tusker/Views/ContentTextView.swift +++ b/Tusker/Views/ContentTextView.swift @@ -10,6 +10,8 @@ import UIKit import SwiftSoup import Pachyderm import SafariServices +import WebURL +import WebURLFoundationExtras private let emojiRegex = try! NSRegularExpression(pattern: ":(\\w+):", options: []) @@ -100,7 +102,8 @@ class ContentTextView: LinkTextView, BaseEmojiLabel { attributed.append(NSAttributedString(string: "\n")) case "a": if let link = try? node.attr("href"), - let url = URL(string: link) { + let webURL = WebURL(link), + let url = URL(webURL) { attributed.addAttribute(.link, value: url, range: attributed.fullRange) } case "p":