diff --git a/android/capacitor/src/main/java/com/getcapacitor/ProcessedRoute.java b/android/capacitor/src/main/java/com/getcapacitor/ProcessedRoute.java index cf28e009c7..eb3d7b0deb 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/ProcessedRoute.java +++ b/android/capacitor/src/main/java/com/getcapacitor/ProcessedRoute.java @@ -9,6 +9,7 @@ public class ProcessedRoute { private String path; private boolean isAsset; + private boolean ignoreAssetPath; public String getPath() { return path; @@ -25,4 +26,12 @@ public boolean isAsset() { public void setAsset(boolean asset) { isAsset = asset; } + + public boolean isIgnoreAssetPath() { + return ignoreAssetPath; + } + + public void setIgnoreAssetPath(boolean ignoreAssetPath) { + this.ignoreAssetPath = ignoreAssetPath; + } } diff --git a/android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java b/android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java index 097e25af40..6ef1235007 100755 --- a/android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java +++ b/android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java @@ -484,10 +484,12 @@ public InputStream handle(Uri url) { // Pass path to routeProcessor if present RouteProcessor routeProcessor = bridge.getRouteProcessor(); + boolean ignoreAssetPath = false; if (routeProcessor != null) { ProcessedRoute processedRoute = bridge.getRouteProcessor().process("", path); path = processedRoute.getPath(); isAsset = processedRoute.isAsset(); + ignoreAssetPath = processedRoute.isIgnoreAssetPath(); } try { @@ -501,6 +503,8 @@ public InputStream handle(Uri url) { } stream = protocolHandler.openFile(path); + } else if (ignoreAssetPath) { + stream = protocolHandler.openAsset(path); } else { stream = protocolHandler.openAsset(assetPath + path); }