mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-19 13:00:21 +01:00
Use percent-encoding — via URLComponents — on the articleID in the nnwImageIcon URL scheme.
This commit is contained in:
parent
f1e01e06fc
commit
cac67f8ac4
@ -140,7 +140,16 @@ private extension ArticleRenderer {
|
||||
d["title"] = title
|
||||
|
||||
d["body"] = body
|
||||
d["avatars"] = "<td class=\"header rightAlign avatar\"><img id=\"nnwImageIcon\" src=\"\(ArticleRenderer.imageIconScheme)://\(article.articleID)\" height=48 width=48 /></td>";
|
||||
|
||||
var components = URLComponents()
|
||||
components.scheme = Self.imageIconScheme
|
||||
components.path = article.articleID
|
||||
if let imageIconURLString = components.string {
|
||||
d["avatars"] = "<td class=\"header rightAlign avatar\"><img id=\"nnwImageIcon\" src=\"\(imageIconURLString)\" height=48 width=48 /></td>"
|
||||
}
|
||||
else {
|
||||
d["avatars"] = ""
|
||||
}
|
||||
|
||||
var feedLink = ""
|
||||
if let feedTitle = article.webFeed?.nameForDisplay {
|
||||
|
@ -24,9 +24,11 @@ class ArticleIconSchemeHandler: NSObject, WKURLSchemeHandler {
|
||||
urlSchemeTask.didFailWithError(URLError(.fileDoesNotExist))
|
||||
return
|
||||
}
|
||||
|
||||
let articleID = url.absoluteString.stripping(prefix: "\(ArticleRenderer.imageIconScheme)://")
|
||||
|
||||
|
||||
guard let components = URLComponents(url: url, resolvingAgainstBaseURL: false) else {
|
||||
return
|
||||
}
|
||||
let articleID = components.path
|
||||
guard let iconImage = coordinator.articleFor(articleID)?.iconImage() else {
|
||||
urlSchemeTask.didFailWithError(URLError(.fileDoesNotExist))
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user