Skip to content

Conversation

@danielniccoli
Copy link
Contributor

@danielniccoli danielniccoli commented Aug 30, 2023

Fixes #10657

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

@changeset-bot
Copy link

changeset-bot bot commented Aug 30, 2023

⚠️ No Changeset found

Latest commit: 7baed59

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Conduitry
Copy link
Member

I'm wondering whether we instead just want to ensure that the URLs begin with \w+:, and what sort of false negatives that would result in. I don't know. I don't know whether it makes sense to explicitly call out data: separately from all of the other URL schemes.

@danielniccoli
Copy link
Contributor Author

danielniccoli commented Aug 30, 2023

Edit

Then we should discuss proper scheme identifications. As per https://www.rfc-editor.org/rfc/rfc3986#section-3.1 schemes are defined as

scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

A regular expression that matches this is /^[a-z][a-z\d+\-.]+:/i. This should catch all possible edge cases, but leaves it to the developer to pass a registered or valid scheme.

I will change the pull request, if that is an agreeable approach.

@benmccann benmccann changed the title Fixes #10657 fix: allow calling fetch with data: URL Aug 30, 2023
@danielniccoli
Copy link
Contributor Author

@Conduitry @benmccann Would the approach above be acceptable? I'm ready to update this PR. Please let me know.

@benmccann
Copy link
Member

That sounds fine, but I think your translation from text to reflex omitted uppercase letters and "+"

@danielniccoli danielniccoli deleted the fix-9160 branch September 9, 2023 19:59
@danielniccoli
Copy link
Contributor Author

Replaced by #10699 (Sorry, pull requests are somewhat challenging for me 🙂 )

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.

fetch with data URL throws error when used in SvelteKit

3 participants