Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 4d95709

Browse files
authored
Merge pull request #184 from chrissloey/0.10.1
Fix Android file saving bug
2 parents 5da0113 + 9d5a5d9 commit 4d95709

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ public RNFetchBlobFileResp(ReactApplicationContext ctx, String taskId, ResponseB
4646
path = path.replace("?append=true", "");
4747
mPath = path;
4848
File f = new File(path);
49+
50+
File parent = f.getParentFile();
51+
if(!parent.exists() && !parent.mkdirs()){
52+
throw new IllegalStateException("Couldn't create dir: " + parent);
53+
}
54+
4955
if(f.exists() == false)
5056
f.createNewFile();
5157
ofStream = new FileOutputStream(new File(path), appendToExistingFile);

0 commit comments

Comments
 (0)