Skip to content

Some characters are not properly encoded in path params #5760

@DreierF

Description

@DreierF

Which project does this relate to?

Router

Describe the bug

Some characters like ? and # are currently not encoded when given in a path parameter, which breaks the URLs as everything behind ?/# is treated as search/hash then.

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-uowmpf4j?file=src%2Froutes%2Fposts.route.tsx

Steps to Reproduce the Bug or Issue

Click on one of the posts in the linked stackblitz example. The links point to

<Link
                  to="/posts/$postId"
                  params={{
                    postId: '#?' + post.id,
                  }}

and end up as /posts/#?1 in the URL.

Expected behavior

The URL should be /posts/%23%3F1

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.134.12
  • Browser: Chrome

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions