From 5ed5e8825b98c37f84f6c4091c5ccba7656f3ad0 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Mon, 29 May 2017 12:49:32 -0700 Subject: [PATCH] =?UTF-8?q?Avoid=20URL=20fragment=20in=20base=20URL,=20sin?= =?UTF-8?q?ce=20the=20webview=20won=E2=80=99t=20accept=20that=20as=20a=20b?= =?UTF-8?q?ase=20URL.=20Fix=20#32.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Evergreen/MainWindow/Detail/ArticleRenderer.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Evergreen/MainWindow/Detail/ArticleRenderer.swift b/Evergreen/MainWindow/Detail/ArticleRenderer.swift index dbb21f108..0cda6f53d 100644 --- a/Evergreen/MainWindow/Detail/ArticleRenderer.swift +++ b/Evergreen/MainWindow/Detail/ArticleRenderer.swift @@ -60,7 +60,15 @@ class ArticleRenderer { return nil } - if let url = URL(string: s!) { + var urlComponents = URLComponents(string: s!) + 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 + + if let url = urlComponents!.url { if url.scheme == "http" || url.scheme == "https" { return url }