Skip to content

Recognize case and spaces in data URL base64 markers - #2386

Merged
martindurant merged 2 commits into
fsspec:masterfrom
jdotc1:fix/data-url-base64-markers-20261027
Oct 27, 2026
Merged

martindurant merged 2 commits into
fsspec:masterfrom
jdotc1:fix/data-url-base64-markers-20261027

Conversation

@jdotc1

@jdotc1 jdotc1 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Data URLs with an uppercase or mixed-case base64 marker, permitted spaces after the semicolon, or trailing ASCII whitespace currently return the encoded text as file contents.

Recognize the marker using ASCII case-insensitive matching and the permitted whitespace rules from the WHATWG data URL processor, steps 6 and 11. Keep percent decoding and range slicing unchanged. Regression tests exercise cat_file, sliced reads, info, and open, and ensure media-type parameters, Unicode lookalikes, and non-ASCII spaces do not become encoding markers.

Validation: python -m pytest fsspec/implementations/tests/test_data.py -q — 43 passed. Ruff lint and format checks pass for both changed Python files. The new cases fail against the original source and pass with this correction.

@martindurant
martindurant merged commit be08c4c into fsspec:master Oct 27, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants