Skip to content

Commit a072a1a

Browse files
committed
Fix content length to be capped at Integer.MAX_VALUE for downloads
1 parent 1512092 commit a072a1a

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)