Skip to content

Commit 809ff45

Browse files
authored
Fix copyFile on Android. (#392)
1 parent 64f151a commit 809ff45

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

android/src/main/java/io/github/elyx0/reactnativedocumentpicker/DocumentPickerModule.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,9 @@ public static String copyFile(Context context, Uri uri, File destFile) throws IO
265265
if (in != null) {
266266
out = new FileOutputStream(destFile);
267267
byte[] buffer = new byte[1024];
268-
while (in.read(buffer) > 0) {
269-
out.write(buffer);
268+
int len;
269+
while ((len = in.read(buffer)) > 0) {
270+
out.write(buffer, 0, len);
270271
}
271272
out.close();
272273
in.close();

0 commit comments

Comments
 (0)