plexorama commented on issue #1361:
URL:
https://github.com/apache/cordova-android/issues/1361#issuecomment-1172901605
> cordova-android@10 : overriden `remapUri` in plugin is not being called in
plugin even if "AndroidInsecureFileModeEnabled" is enabled. still using
cordova-android@9
I've encountered the same issue with cordova-android@10, remapUri is never
called. The reason is for this is, the deprecated
shouldInterceptRequest(WebView view, String url) method - implement in the
cordova SystemWebViewClient-class - is never called by the WebView. As a
consequence, the remapUri-method is never invoked. However, there are two
versions of the shouldInterceptRequest-method. The 'new' version of
shouldInterceptRequest is called by WebView, which then invokes
assetLoader.shouldInterceptRequest - that however is wrong in my opinion. It
should call the old shouldInterceptRequest-method first and if that returns
null, the assetLoader.shouldInterceptRequest-method should be invoked as a
fallback.
if you want to re-enable the remapUri-invocation, change the new
shouldInterceptRequest-method
CordovaLib/src/org/apache/cordova/engine/SystemWebViewClient.java as follows:
replace this method:
```
public WebResourceResponse shouldInterceptRequest(WebView view,
WebResourceRequest request) {
return this.assetLoader.shouldInterceptRequest(request.getUrl());
}
```
with the following code:
```
public WebResourceResponse shouldInterceptRequest(WebView view,
WebResourceRequest request) {
Log.d(TAG, String.format("shouldInterceptRequest():
request=%s",request.getUrl()));
WebResourceResponse response =
shouldInterceptRequest(view,request.getUrl().toString());
if (response != null){
return response;
}
return this.assetLoader.shouldInterceptRequest(request.getUrl());
}
```
This will re-enable the old remapUri-behaviour.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]