Skip to content

Do not pass data: fetch requests to the native http request handler#8347

Closed
frederikbosch wants to merge 1 commit intoionic-team:mainfrom
frederikbosch:patch-2
Closed

Do not pass data: fetch requests to the native http request handler#8347
frederikbosch wants to merge 1 commit intoionic-team:mainfrom
frederikbosch:patch-2

Conversation

@frederikbosch
Copy link

@frederikbosch frederikbosch commented Feb 15, 2026

For all sorts of reasons, a fetch request of data URI might be executed.

fetch(new URL('data:text/css,body{background:red}'))

At the moment these requests are forwarded to the native request, causing crashes like the one that PR #8304 is trying to solve. With this PR, data: requests will not be forwarded anymore to native request layer.

Just to explain why, in my app, I am fetching a DATA CSS Uri.

  • in my app the following code fetch(new URL('./file.css'))
  • is compiled by Vite as fetch(new URL('data:text/css,body{background:red}'))
  • so, while I am not intentionally fetching a data URI, it is compiled as such, because the resource is so small that Vite modifies it to an inline asset

@jcesarmobile
Copy link
Member

Thanks for the PR, but while this change solves your issue, it doesn't address the real problem.
The real problem is that we are not handling URL objects on fetch calls.
I've addressed it here #8386

As I commented on #8304, I had already tried a fetch call with a data:// url and it was working fine, because I passed it as string, since now you have shared that you were using an URL object, I tried and verified that it causes the crash.

@frederikbosch
Copy link
Author

Thanks @jcesarmobile

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