Skip to content

Route params are incorrectly percent-encoded/decoded when containing spaces and percent signs #14619

@ablasik

Description

@ablasik

Reproduction

Description

When a route parameter contains both spaces and percent signs (e.g. 2% 0 g - 2), React Router v7 incorrectly parses it and double-encodes parts of the value. As a result, the loader receives a malformed parameter instead of the original value.

Reproduction:

Open below link and click on malformed link
https://stackblitz.com/edit/github-xxbxv2kq-zckgutyc?file=app%2Froutes%2Fmalformed.tsx

System Info

n/a

Used Package Manager

pnpm

Expected Behavior

params.id should equal exactly:

2% 0 g - 2

Actual Behavior

React Router returns:

2%%200%20g%20-%202

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions