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

Conversation

xxkl1
Copy link

@xxkl1 xxkl1 commented Sep 12, 2022

Description

Possible fix for (#9917 )

The reason for this problem is node.js fs.readFile error when take the path with the space URL encode.

fix problem by replace %20 by space when resolve file path.

use replace method because of encodeURIComponent is unsafe (#8498)

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.

})
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

@xxkl1 xxkl1 closed this Nov 25, 2022
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