From e73e2791890fa02066ac89fb4cfaad7cfb47772c Mon Sep 17 00:00:00 2001 From: Ron Radtke Date: Sat, 18 Dec 2021 10:27:37 +0100 Subject: [PATCH] Fixes #88 --- .../java/com/ReactNativeBlobUtil/ReactNativeBlobUtilReq.java | 2 +- .../Response/ReactNativeBlobUtilFileResp.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilReq.java b/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilReq.java index 998023ee2..5b40b1286 100644 --- a/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilReq.java +++ b/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilReq.java @@ -604,7 +604,7 @@ private void done(Response resp) { ReactNativeBlobUtilFileResp ReactNativeBlobUtilFileResp; try { - ReactNativeBlobUtilFileResp = (ReactNativeBlobUtilFileResp) responseBody; + ReactNativeBlobUtilFileResp = new ReactNativeBlobUtilFileResp(responseBody); } catch (ClassCastException ex) { // unexpected response type if (responseBody != null) { diff --git a/android/src/main/java/com/ReactNativeBlobUtil/Response/ReactNativeBlobUtilFileResp.java b/android/src/main/java/com/ReactNativeBlobUtil/Response/ReactNativeBlobUtilFileResp.java index 9065d001d..f38d17784 100644 --- a/android/src/main/java/com/ReactNativeBlobUtil/Response/ReactNativeBlobUtilFileResp.java +++ b/android/src/main/java/com/ReactNativeBlobUtil/Response/ReactNativeBlobUtilFileResp.java @@ -35,6 +35,11 @@ public class ReactNativeBlobUtilFileResp extends ResponseBody { FileOutputStream ofStream; boolean isEndMarkerReceived; + public ReactNativeBlobUtilFileResp(ResponseBody body) { + super(); + this.originalBody = body; + } + public ReactNativeBlobUtilFileResp(ReactApplicationContext ctx, String taskId, ResponseBody body, String path, boolean overwrite) throws IOException { super(); this.rctContext = ctx;