From 4f7bf8df3a574c6ba8c3e37a78f8f865ae2ee2df Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Thu, 23 Jul 2020 16:15:00 +0200 Subject: [PATCH] fix(android): Don't return 404 on empty files --- .../ionicframework/cordova/webview/WebViewLocalServer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/android/com/ionicframework/cordova/webview/WebViewLocalServer.java b/src/android/com/ionicframework/cordova/webview/WebViewLocalServer.java index cf134932..1bb27604 100644 --- a/src/android/com/ionicframework/cordova/webview/WebViewLocalServer.java +++ b/src/android/com/ionicframework/cordova/webview/WebViewLocalServer.java @@ -193,7 +193,7 @@ private static WebResourceResponse createWebResourceResponse(String mimeType, St if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int finalStatusCode = statusCode; try { - if (data.available() == 0) { + if (data.available() == -1) { finalStatusCode = 404; } } catch (IOException e) { @@ -595,7 +595,7 @@ private InputStream getInputStream() { @Override public int available() throws IOException { InputStream is = getInputStream(); - return (is != null) ? is.available() : 0; + return (is != null) ? is.available() : -1; } @Override