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: read file error on path has url space encode #10090

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions packages/vite/src/node/server/pluginContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,17 @@ export async function createPluginContainer(
'handler' in plugin.resolveId
? plugin.resolveId.handler
: plugin.resolveId
const result = await handler.call(ctx as any, rawId, importer, {
custom: options?.custom,
isEntry: !!options?.isEntry,
ssr,
scan
})
const result = await handler.call(
ctx as any,
rawId.replace(/%20/g, ' '),

Choose a reason for hiding this comment

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

can we just use decodeURI(rawId)

Choose a reason for hiding this comment

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

Copy link
Author

@xxkl1 xxkl1 Sep 14, 2022

Choose a reason for hiding this comment

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

failed to pass the test using decodeURI, see #8498

importer,
{
custom: options?.custom,
isEntry: !!options?.isEntry,
ssr,
scan
}
)
if (!result) continue

if (typeof result === 'string') {
Expand Down