Skip to content

fix(event): save inline rx.download data through a blob url - #7853

Open
abulvenz wants to merge 6 commits into
reflex-dev:mainfrom
abulvenz:download-blob-url
Open

abulvenz wants to merge 6 commits into
reflex-dev:mainfrom
abulvenz:download-blob-url

Conversation

@abulvenz

@abulvenz abulvenz commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

iOS WebKit (Safari, every other iOS browser and installed PWAs) ignores the download attribute of data: urls and only displays the file instead of saving it. rx.download(data=...) always produces a data: url, so it never saves a file on iOS.

The _download event now turns a data: url into a blob: url before clicking the link, and attaches the link to the document first. Downloads of regular urls are unchanged.

Tests: a Playwright test downloads inline text from a frontend event and bytes from a backend event and asserts the blob url, file name and exact content. It fails without the fix.

View guided diff

@abulvenz
abulvenz requested a review from a team as a code owner November 11, 2026 22:00
iOS WebKit (every iOS browser and installed PWAs) ignores the download
attribute of data: urls and only shows the file as text. The _download
event turns a data: url into a blob: url and attaches the link to the
document before clicking it.
@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Makes inline rx.download files save through a blob URL on iOS.

  • Inline data downloads now save through blob URLs.

Reviews (5) · Last reviewed commit: "Merge branch 'download-blob-url-exact-ur..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 21 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 151 untouched benchmarks


Comparing abulvenz:download-blob-url (c6f3c59) with main (cb9ee91)

Open in CodSpeed

A connect-src policy that does not allow data: urls blocks fetching one,
so the _download event decodes the base64 or percent-encoded data itself
before building the blob: url.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

@FarhanAliRaza FarhanAliRaza added the bug Something isn't working label Nov 12, 2026 — with ChatGPT Codex Connector
…load like fetch

A data: url handed to rx.download through a Var is passed on unchanged and
may carry a fragment or percent-encode its base64 body. Drop the fragment
and percent-decode the body before base64-decoding it, as the data url
processor does.
@abulvenz

Copy link
Copy Markdown
Contributor Author

@codspeedbot fix this regression

@abulvenz

Copy link
Copy Markdown
Contributor Author

The CodSpeed regression in test_route_matching[100] (−5.9%) is unrelated to this change: the PR only touches state.js, an integration test and a news fragment, none of which run in that benchmark. It matches the flaky ±5.5–5.9% swings of route_matching that #7878 describes, which come from the benchmark measuring a few lru_cache hits

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants