Skip to content

Router incorrectly uses encodeURIComponent in path segemtns #559

@mitsuhiko

Description

@mitsuhiko

Describe the bug

solid-router uses the wrong way to encode path parameters. It uses encodeURIComponent (which is for query strings) instead of encodeURI. This causes +foo to be encoded as %2Bfoo.

https://github.com/solidjs/solid-router/blob/e54fc4a3bc51d0727df052603a7c92d9da8e099b/src/routing.ts#L295C63-L295C81

Your Example Website or App

have none

Steps to Reproduce the Bug or Issue

  1. register a URL with +foo as segment
  2. encounter a 404 when navigating to it as it encodes it to %2Bfoo.

Expected behavior

It should navigate to +foo instead.

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: any browser

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