Avoid URL fragment in base URL, since the webview won’t accept that as a base URL. Fix #32.

This commit is contained in:
Brent Simmons 2017-05-29 12:49:32 -07:00
parent e4da1b4716
commit 5ed5e8825b
1 changed files with 9 additions and 1 deletions

View File

@ -60,7 +60,15 @@ class ArticleRenderer {
return nil
}
if let url = URL(string: s!) {
var urlComponents = URLComponents(string: s!)
if urlComponents == nil {
return nil
}
// Cant use url-with-fragment as base URL. The webview wont 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
}