mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
Adding workaround for ICS asset URLs with spaces
This commit is contained in:
parent
fcd2c989a2
commit
0d4d0b8a37
@ -42,7 +42,7 @@ public class IceCreamCordovaWebViewClient extends CordovaWebViewClient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
|
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
|
||||||
if(url.contains("?") || url.contains("#")){
|
if(url.contains("?") || url.contains("#") || needsSpaceInAssetUrlFix(url)){
|
||||||
return generateWebResourceResponse(url);
|
return generateWebResourceResponse(url);
|
||||||
} else {
|
} else {
|
||||||
return super.shouldInterceptRequest(view, url);
|
return super.shouldInterceptRequest(view, url);
|
||||||
@ -80,4 +80,18 @@ public class IceCreamCordovaWebViewClient extends CordovaWebViewClient {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean needsIceCreamSpaceInAssetUrlFix(String url) {
|
||||||
|
if (!url.contains("%20")){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(android.os.Build.VERSION.SDK_INT){
|
||||||
|
case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH:
|
||||||
|
case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user