Don't link to redd.it

This commit is contained in:
Maurice Parker 2020-05-05 21:42:20 -05:00
parent cce420b31d
commit a8f6b27c48

View File

@ -116,7 +116,10 @@ struct RedditLinkData: Codable {
}
func linkOutURL(_ url: String) -> String {
guard let urlComponents = URLComponents(string: url), let host = urlComponents.host, !host.hasSuffix("reddit.com") else {
guard let urlComponents = URLComponents(string: url), let host = urlComponents.host else {
return ""
}
guard !host.hasSuffix("reddit.com") && !host.hasSuffix("redd.it") else {
return ""
}
return "<div><a href=\"\(url)\">\(url)</a></div>"