Skip to content

Commit

Permalink
Merge pull request #123 from treyreynolds/fix-android-large-files
Browse files Browse the repository at this point in the history
Fix content length to be capped at Integer.MAX_VALUE for downloads
  • Loading branch information
RonRadtke authored Mar 20, 2022
2 parents 1e4610a + a072a1a commit acfb2f0
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public MediaType contentType() {

@Override
public long contentLength() {
if (originalBody.contentLength() > Integer.MAX_VALUE) {
// This is a workaround for a bug Okio buffer where it can't handle larger than int.
return Integer.MAX_VALUE;
}
return originalBody.contentLength();
}

Expand Down

0 comments on commit acfb2f0

Please sign in to comment.