diff --git a/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift b/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift index 73bf3b159..e15ab94fb 100644 --- a/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift +++ b/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift @@ -98,6 +98,7 @@ struct RedditLinkData: Codable { html += "width=\"\(width)\" height=\"\(height)\" " } html += "src=\"\(videoPreviewURL)\">" + html += linkOutURL(url) return html } @@ -107,10 +108,18 @@ struct RedditLinkData: Codable { html += "width=\"\(width)\" height=\"\(height)\" " } html += ">" + html += linkOutURL(url) return html } - return nil + return linkOutURL(url) + } + + func linkOutURL(_ url: String) -> String { + guard let urlComponents = URLComponents(string: url), let host = urlComponents.host, !host.hasSuffix("reddit.com") else { + return "" + } + return "
\(url)
" } }