Skip to content

Comments

fix(server): replace unescape with decodeURIComponent#6408

Merged
chenjiahan merged 1 commit intomainfrom
replace_querystring_1022
Oct 22, 2025
Merged

fix(server): replace unescape with decodeURIComponent#6408
chenjiahan merged 1 commit intomainfrom
replace_querystring_1022

Conversation

@chenjiahan
Copy link
Member

Summary

Replace unescape with decodeURIComponent, from Node.js documentation:

The querystring.unescape() method is used by querystring.parse() and is generally not expected to be used directly.

By default, the querystring.unescape() method will attempt to use the JavaScript built-in decodeURIComponent() method to decode. If that fails, a safer equivalent that does not throw on malformed URLs will be used.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings October 22, 2025 11:16
@netlify
Copy link

netlify bot commented Oct 22, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 85aff9e
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68f8bd22cac6cf00088e8ecb
😎 Deploy Preview https://deploy-preview-6408--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 77 (🟢 up 11 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the URL decoding mechanism in the file resolution logic by replacing Node.js's deprecated querystring.unescape() with the standard decodeURIComponent() function. The change aligns with Node.js documentation recommendations and uses a safer, more widely supported decoding approach.

  • Removes dependency on the querystring module
  • Introduces a custom decodePath helper function that wraps decodeURIComponent with error handling
  • Updates the pathname decoding in getFileFromUrl to use the new helper

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@chenjiahan chenjiahan merged commit f3e30a2 into main Oct 22, 2025
12 checks passed
@chenjiahan chenjiahan deleted the replace_querystring_1022 branch October 22, 2025 13:13
@chenjiahan chenjiahan mentioned this pull request Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant