🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@therungg
Copy link

@therungg therungg commented Dec 9, 2025

What?

This encodes and re-decodes the path param before throwing an error from decodeURIComponent.

Why?

More often than not, the error is thrown when a string given to decodeURIComponent has already been decoded. This means that a string like %25 will already be decoded to %, which results in an error from decodeURIComponent. This is also the case for this function. The parameter given is already encoded once, so this function will fail with %25. This PR fixes that by applying the standard solution to this problem: re-encoding, then re-decoding.

If decodeURIComponent still throws an error, the same DecodeError as before is thrown, because that means something different is the culprit.

How?

By re-encoding, then re-decoding the string.

Closes NEXT-
Fixes #86957

@nextjs-bot
Copy link
Collaborator

nextjs-bot commented Dec 9, 2025

Allow CI Workflow Run

  • approve CI run for commit: 5bd1b00

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@therungg therungg force-pushed the fix/avoid-double-encoding-path-params branch from 212d508 to 3a0cf26 Compare December 9, 2025 22:50
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.

Internal Server Error on dynamic routes with %25 in the dynamic param with cacheComponents enabled

2 participants