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

Inconsistent path encoding #2698

Open
BobbieGoede opened this issue Jan 13, 2024 · 1 comment
Open

Inconsistent path encoding #2698

BobbieGoede opened this issue Jan 13, 2024 · 1 comment
Assignees
Labels
❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf routing v8

Comments

@BobbieGoede
Copy link
Collaborator

BobbieGoede commented Jan 13, 2024

Environment

- Operating System: Linux
- Node Version:     v18.18.0
- Nuxt Version:     3.8.0
- CLI Version:      3.9.1
- Nitro Version:    2.7.2
- Package Manager:  npm@9.4.2
- Builder:          -
- User Config:      modules, i18n
- Runtime Modules:  @nuxtjs/i18n@8.0.0-28410629.a2a883f
- Build Modules:    -

Reproduction

https://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-vuphy7?file=pages%2Findex.vue

Scripts to compare behavior:

  • npm run dev
    • strategy = no_prefix
  • npm run dev:alternate-1
    • strategy = prefix_and_default
  • npm run dev:alternate-2
    • strategy = prefix_and_default
    • defaultLocale = en

Describe the bug

The paths returned by localePath are escaped inconsistently as shown in the scenarios below. It seems to be related to when locale prefixes are used, hence it changes when defaultLocale is set or not when used with strategy prefix_and_default. Found during #2686.

This issue is likely related or the same as previously reported issues related to path encoding .

strategy: "no_prefix"
defaultLocale: "undefined"
localePath: "/path/hello%20world?foo=hello+world"
strategy: "prefix_and_default"
defaultLocale: "undefined"
localePath: "/en/path/hello world?foo=hello+world"
strategy: "prefix_and_default"
defaultLocale: "en"
localePath: "/path/hello%20world?foo=hello+world"

Additional context

No response

Logs

No response

@BobbieGoede BobbieGoede added v8 ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf routing labels Jan 13, 2024
@BobbieGoede BobbieGoede self-assigned this Jan 13, 2024
@mcombes-ew
Copy link

I am having a similar issue with Nuxt 3.

As an example: if I navigate to a page like the link below everything works as intended.

         mysite.net/somePath/some%20%26%20path

But if there is any query string at the end it decodes the %26 to an & like example below.

         mysite.net/somePath/some%20%26%20path?queryString=true

gets decoded to
mysite.net/somePath/some%20&%20path?queryString=true

Can not figure out why this is happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf routing v8
Projects
None yet
Development

No branches or pull requests

2 participants