Skip to content

Commit acfb2f0

Browse files
authored
Merge pull request #123 from treyreynolds/fix-android-large-files
Fix content length to be capped at Integer.MAX_VALUE for downloads
2 parents 1e4610a + a072a1a commit acfb2f0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

android/src/main/java/com/ReactNativeBlobUtil/Response/ReactNativeBlobUtilFileResp.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ public MediaType contentType() {
7272

7373
@Override
7474
public long contentLength() {
75+
if (originalBody.contentLength() > Integer.MAX_VALUE) {
76+
// This is a workaround for a bug Okio buffer where it can't handle larger than int.
77+
return Integer.MAX_VALUE;
78+
}
7579
return originalBody.contentLength();
7680
}
7781

0 commit comments

Comments
 (0)