Skip to content

[Bug]: PR #8357 Regression #8367

@bwees

Description

@bwees

Capacitor Version

8.1.1-nightly-20260227T151709.0

Other API Details

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

The addition of

int bytesToSkip;
try {
   bytesToSkip = Integer.parseInt(fromRange);
   if (bytesToSkip > 0) {
       responseStream.skip(bytesToSkip);
   }
} catch (NumberFormatException ignored) {}

in PR #8357 improperly seeks the responseStream an additional bytesToSkip.

I have checked the binary output via chrome devtools on 8.1.0 and then on 8.1.1 nightly and compared the outputs to a curl request against a vite dev server (which is my "source of truth" here since it properly serves the range requests when using it for hot reload).

Vite Dev Server (first 16 bytes)

This is the "expected" output from Capacitor server

curl 'http://localhost:5173/map/cstat.pmtiles' \
  -H 'sec-ch-ua-platform: "Android"' \
  -H 'Referer: https://localhost/' \
  -H 'User-Agent: Mozilla/5.0 (Linux; Android 16; SM-S911U1 Build/BP2A.250605.031.A3; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/142.0.7444.102 Mobile Safari/537.36' \
  -H 'sec-ch-ua: "Chromium";v="142", "Android WebView";v="142", "Not_A Brand";v="99"' \
  -H 'range: bytes=389189-420083' \
  -H 'sec-ch-ua-mobile: ?1' --output test.pmtiles

Output (first 16 bytes): 1F 8B 08 00 00 00 00 00 00 FF 7C BC 09 98 54 D5

Android on Capacitor 8.1.0 (same byte range as vite server)

Output (first 16 bytes): 1F 8B 08 00 00 00 00 00 00 FF 7C BC 09 98 54 D5

Android on Capacitor 8.1.1-nightly-20260227T151709.0 (same byte range as vite server)

Output (first 16 bytes): 77 B0 9C B5 45 DE 28 50 43 EA E8 48 F3 54 B1 9D

Expected Behavior

The range request should seek to the correct position in the file as it did in v8.1.0.

Project Reproduction

See the current behavior.

Additional Information

It appears that the addition of the seek is offsetting the file twice. I'm not sure if the mimeType operations or other functions called on the stream are automatically seeking the file.

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions