Skip to content
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

fix: injectQuery break relative path #9760

Merged
merged 9 commits into from Aug 24, 2022
Merged

Conversation

poyoho
Copy link
Member

@poyoho poyoho commented Aug 19, 2022

Description

fix: #9525

Additional context

injectQuery break the relative path. if url[0] is not '/' should be relative path, should .slice(1)


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@poyoho poyoho added feat: web workers p3-minor-bug An edge case that only affects very specific usage (priority) and removed feat: web workers labels Aug 19, 2022
bluwy
bluwy previously approved these changes Aug 19, 2022
Comment on lines 16 to 20
test('normalize windows path', () => {
expect(injectQuery('C:\\User\\Vite\\Project', 'direct')).toEqual(
'C:/User/Vite/Project?direct'
'C:\\User\\Vite\\Project?direct'
)
})
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure but maybe we need to normalize path.
It seems related to #2435, #2614 but Idk whether this is needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

It can to exec normalizePath it will reducing '..' and '.' parts. But now it will lose When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. this feature.

@patak-dev patak-dev merged commit 61273b2 into vitejs:main Aug 24, 2022
@poyoho poyoho deleted the utils/injectQuery branch August 25, 2022 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WorkerWrapper seems to always use a relative URL
4 participants