Skip to content

Single quotes in route params will cause the page crash #1302

@arianrhodsandlot

Description

@arianrhodsandlot

Let's say given a route "/book/[name]" in a waku app, when we visit a path containing a single quote ', for example, "/book/Webster's%20Dictionary", the page will crash with a message "Invalid element: route:/book/Webster's%20Dictionary".

Reproduction: https://stackblitz.com/edit/stackblitz-starters-yjfjlhke


Additionally, the route params recieved in the page entry component are not decoded with decodeURIComponent.

export default function Book({ name }) {
  // We got `Webster's%20Dictionary` rather than `Webster's Dictionary` here
  return <div>{name}</div>
}

Not sure is this behaviour by design or not? As I tested, Next.js' app router doesn't decode it too, but its legacy page router will decode it when calling useRouter to retrieve the route params.

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