Merge pull request #3773 from kiwix/Fix#3647

Fixed: Spurious message: "Error: Loading article (Url: https://uploadwikimedia.org/wikipedia/commons/6/65/Lock-green.svg"
This commit is contained in:
Kelson 2024-04-04 07:14:04 +02:00 committed by GitHub
commit f0af00b7f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -2037,8 +2037,7 @@ abstract class CoreReaderFragment :
override fun webViewFailedLoading(url: String) {
if (isAdded) {
val error = String.format(getString(R.string.error_article_url_not_found), url)
Toast.makeText(requireActivity(), error, Toast.LENGTH_SHORT).show()
Log.d(TAG_KIWIX, String.format(getString(R.string.error_article_url_not_found), url))
}
}

View File

@ -149,7 +149,13 @@ open class CoreWebViewClient(
return if (url.startsWith(ZimFileReader.CONTENT_PREFIX)) {
zimReaderContainer.load(url, request.requestHeaders)
} else {
super.shouldInterceptRequest(view, request)
// Return an empty WebResourceResponse for the external resource to prevent
// it from being loaded. Passing null would trigger an attempt to load the resource.
WebResourceResponse(
"text/css",
Charsets.UTF_8.name(),
null
)
}
}