diff --git a/Shared/Article Rendering/ArticleRenderer.swift b/Shared/Article Rendering/ArticleRenderer.swift index 4dfe61757..7643b1091 100644 --- a/Shared/Article Rendering/ArticleRenderer.swift +++ b/Shared/Article Rendering/ArticleRenderer.swift @@ -365,6 +365,9 @@ private extension ArticleRenderer { func renderHTML(withBody body: String) -> String { var s = "\n" + if let baseURL = baseURL { + s += ("") + } s += "\n" s += title.htmlBySurroundingWithTag("title") s += styleString().htmlBySurroundingWithTag("style") diff --git a/iOS/Detail/DetailViewController.swift b/iOS/Detail/DetailViewController.swift index 338f67998..0b9f81269 100644 --- a/iOS/Detail/DetailViewController.swift +++ b/iOS/Detail/DetailViewController.swift @@ -64,7 +64,7 @@ class DetailViewController: UIViewController { } let style = ArticleStylesManager.shared.currentStyle let html = ArticleRenderer.articleHTML(article: article, style: style) - webView.loadHTMLString(html, baseURL: article.baseURL) + webView.loadHTMLString(html, baseURL: nil) } @objc func statusesDidChange(_ note: Notification) { @@ -155,33 +155,5 @@ extension DetailViewController: WKNavigationDelegate { } } -} - -private extension Article { - - var baseURL: URL? { - var s = url - if s == nil { - s = feed?.homePageURL - } - if s == nil { - s = feed?.url - } - - guard let urlString = s else { - return nil - } - var urlComponents = URLComponents(string: urlString) - if urlComponents == nil { - return nil - } - - // Can’t use url-with-fragment as base URL. The webview won’t load. See scripting.com/rss.xml for example. - urlComponents!.fragment = nil - guard let url = urlComponents!.url, url.scheme == "http" || url.scheme == "https" else { - return nil - } - return url - } }