Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router resolve does not encode path #2021

Closed
Achneoder opened this issue Oct 18, 2023 · 1 comment
Closed

Router resolve does not encode path #2021

Achneoder opened this issue Oct 18, 2023 · 1 comment

Comments

@Achneoder
Copy link

Reproduction

main...Achneoder:router:test_path_encoding

Steps to reproduce the bug

  1. Checkout repository and branch test_path_encoding
  2. pnpm i
  3. pnpm test

Expected behavior

The test succeeds.

Actual behavior

The test fails.

Additional information

According to the documentation, router.resolve should return a RouteLocation with encoded fullPath (same for path).

I don't know if the current behavior is intended, so that the provided path and/or params already have to be encoded, but that might be inconsistent since the query params will be encoded properly.

Copy link
Member

posva commented Oct 18, 2023

This is working as intended: encoding is done in params and query. Passing a path string lets the browser encode it (https://router.vuejs.org/guide/migration/#-route-properties-Encoding). This is why it's recommended to use named routes with params if params can contain encoded characters 🙂

@posva posva closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants