mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Avoid opening blobs as webpages
Co-Authored-By: arkon <4098258+arkon@users.noreply.github.com>
This commit is contained in:
parent
572ae2d398
commit
7046baaef4
2 changed files with 8 additions and 2 deletions
|
@ -76,7 +76,13 @@ open class WebViewActivity : BaseWebViewActivity() {
|
||||||
|
|
||||||
binding.webview.webViewClient = object : WebViewClientCompat() {
|
binding.webview.webViewClient = object : WebViewClientCompat() {
|
||||||
override fun shouldOverrideUrlCompat(view: WebView, url: String): Boolean {
|
override fun shouldOverrideUrlCompat(view: WebView, url: String): Boolean {
|
||||||
view.loadUrl(url)
|
// Don't attempt to open blobs as webpages
|
||||||
|
if (url.startsWith("blob:http")) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Continue with request, but with custom headers
|
||||||
|
view.loadUrl(url, headers)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import android.webkit.WebView
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
object WebViewUtil {
|
object WebViewUtil {
|
||||||
const val MINIMUM_WEBVIEW_VERSION = 105
|
const val MINIMUM_WEBVIEW_VERSION = 114
|
||||||
|
|
||||||
fun supportsWebView(context: Context): Boolean {
|
fun supportsWebView(context: Context): Boolean {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue