From 105fcd7033aea1a354b361fe5bc96df02e4bc4ab Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Tue, 12 May 2020 07:17:32 -0500 Subject: [PATCH] Always show link for images --- .../Account/FeedProvider/Reddit/RedditLink.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift b/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift index 6fa065e9d..25c29b8e8 100644 --- a/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift +++ b/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift @@ -118,7 +118,7 @@ final class RedditLinkData: Codable { html += "width=\"\(width)\" height=\"\(height)\" " } html += "src=\"\(videoPreviewURL)\" autoplay muted>" - html += linkOutURL(url) + html += linkURL(url) return html } @@ -135,18 +135,18 @@ final class RedditLinkData: Codable { html += "width=\"\(width)\" height=\"\(height)\" " } html += ">" - html += linkOutURL(url) + html += linkURL(url, linkOutOnly: false) return html } - return linkOutURL(url) + return linkURL(url) } - func linkOutURL(_ url: String) -> String { + func linkURL(_ url: String, linkOutOnly: Bool = true) -> String { guard let urlComponents = URLComponents(string: url), let host = urlComponents.host else { return "" } - guard !host.hasSuffix("reddit.com") && !host.hasSuffix("redd.it") else { + guard !linkOutOnly || (!host.hasSuffix("reddit.com") && !host.hasSuffix("redd.it")) else { return "" } var displayURL = "\(urlComponents.host ?? "")\(urlComponents.path)"