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

Fix "URI malformed" due to doubled decodeURI #2900

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

adiantek
Copy link

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

HTML contains:

<link rel="preload" as="fetch" crossorigin="anonymous" href="/product/3178?param_barrier=BARRIER_66%25&param_size_wl=70x160/_payload.json?ba8657c7-63c5-47cb-b1b5-53671eece234">

extractLinks return sth like: /product/3178?param_barrier=BARRIER_66%&param_size_wl=70x160/_payload.json?ba8657c7-63c5-47cb-b1b5-53671eece234, then it goes to generateRoute, where is:

    // Ensure route is decoded to start with
    route = decodeURI(route);

it causes:

Error:  URI malformed
  at decodeURI (<anonymous>)
  at generateRoute (node_modules/nitropack/dist/core/index.mjs:1940:13)
  at node_modules/nitropack/dist/core/index.mjs:1488:128
  at runNextTicks (node:internal/process/task_queues:60:5)
  at process.processImmediate (node:internal/timers:447:9)
  at async Promise.all (index 0)

extractLinks should return encoded URIs, bcoz generateRoute decodes it

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@adiantek adiantek requested a review from pi0 as a code owner November 23, 2024 14:57
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

Successfully merging this pull request may close these issues.

1 participant