-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
breaking: fix path resolution #11276
Conversation
🦋 Changeset detectedLatest commit: 70f0e20 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What were the implications of this buggy behavior? Was it resulting in a bug in some way?
if (path[0] === '#') return base + path; | ||
if (path === '') return base; | ||
// special case | ||
if (path[0] === '/' && path[1] === '/') return path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this special case about? Is this some extra thing we need to mention in the docs? What does this mean for ''
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protocol-relative URLs should remain protocol-relative, but the new URL(...)
technique means we lose that information. so we need to special-case it
"/test♥hex" | ||
"/test%22quotation", | ||
"/test%E2%99%A1decimal", | ||
"/test%E2%99%A5hex" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous results had the character references persisted - will this somehow affect other stuff negatively / in a breaking way now that they no longer are?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured if it did, tests would start failing. Seems fine. Though we're probably now double-decoding at prerender time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof. Double-decoding is bad and would result in breakages. Maybe we don't have a test for prerendering an encoded URL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do:
If there's a bug, it's very well-hidden, and we can fix it when it reveals itself. It shouldn't block merging
Yes #11273 (comment) |
I mean, yes, this is a bug that showed itself there, but I don't understand yet what actual issue this would cause. Maybe the current behavior is actually more desireable? |
It doesn't matter if it's more desirable, it's incorrect! |
That's like saying measuring in inches is incorrect (obviously is, wtf America) and using centimeters is the better variant, but if it turns out that it works in practise and noone has an issue with it, why change it? |
Because it's stupidly confusing if we resolve URLs differently to everyone else on the planet. The fact that it makes it marginally easier to do something you almost certainly don't want to do (emulating confusing default cookie path behaviour) is a terrible reason to keep the broken behaviour |
Ok fine. I just really wished we would've found some special string to signal "I want the default browser behavior" 😄 |
Our
resolve
utility was returning incorrect results in the case wherepath
was just a.
character, leading to confusion such as #11273 (comment).This implementation delegates to
new URL(...)
, so it's more or less guaranteed to be correct whatever edge cases we throw at itPlease don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.