Skip to content

[Bug]: Incorrect Handling of Double-Encoded URL Parameters #11293

Open
@polamoros

Description

@polamoros

What version of React Router are you using?

6.22.1

Steps to Reproduce

  • Define a dynamic route to capture branch names, using the pattern /:branch.
  • Encode a branch name that includes slashes (e.g., fix/my-awesome-fix): fix%2Fmy-awesome-fix
  • Encode the encoded branch name (needed to use it as a URL param): fix%252Fmy-awesome-fix

Expected Behavior

Handle the double-encoded parameter by decoding it once, transforming %252F back to %2F, and preserving the slash as encoded.

Actual Behavior

The double-encoded slash (%252F) in the branch name is decoded twice, converting it directly to /, which misrepresents the original branch name (fix/my-awesome-fix instead of fix%2Fmy-awesome-fix).

Anything else?

I was able to reproduce the issue on versions 6.19 and 6.20, so it's not related to #10814 (comment), which I initially thought might have been the cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions