From ac2506fd64b59ddc614d7e413ed6f8113e3bcca9 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Thu, 7 Nov 2019 14:58:58 -0600 Subject: [PATCH] Don't cache icon views used by the web view. --- iOS/Article/ArticleIconSchemeHandler.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/iOS/Article/ArticleIconSchemeHandler.swift b/iOS/Article/ArticleIconSchemeHandler.swift index 3bd3f1678..55e36a619 100644 --- a/iOS/Article/ArticleIconSchemeHandler.swift +++ b/iOS/Article/ArticleIconSchemeHandler.swift @@ -30,10 +30,12 @@ class ArticleIconSchemeHandler: NSObject, WKURLSchemeHandler { return } - let response = URLResponse(url: responseURL, mimeType: "image/png", expectedContentLength: data.count, textEncodingName: nil); - urlSchemeTask.didReceive(response) - urlSchemeTask.didReceive(data) - urlSchemeTask.didFinish() + let headerFields = ["Cache-Control": "no-cache"] + if let response = HTTPURLResponse(url: responseURL, statusCode: 200, httpVersion: nil, headerFields: headerFields) { + urlSchemeTask.didReceive(response) + urlSchemeTask.didReceive(data) + urlSchemeTask.didFinish() + } } }