fix(android): range request truncation

BW
24d ago
+239-6

Description

Range requests on Android did not properly truncate their streams leading to the remainder of the file being returned instead of only the specified range. The stream was properly seeked (seemingly automatically as discovered in #8369) but continued to respond with the rest of the file.

This PR creates a wrapper around InputStream that properly sends EOF once the specified number of bytes has been read.

Change Type

  • Fix
  • Feature
  • Refactor
  • Breaking Change
  • Documentation

Rationale / Problems Fixed

Closes https://github.com/ionic-team/capacitor/issues/8371

Tests or Reproductions

The minimum reproduction app now loads the map with the patch applied in https://github.com/bwees/range-request-capacitor-repro/tree/range-fix-repro.

I also added additional tests for the BoundedInputStream class

Screenshots / Media

N/A

Platforms Affected

  • Android
  • iOS
  • Web

Notes / Comments

Claude was used to build the BoundedInputStream class and corresponding tests were written to ensure accuracy.