vuepress / core

Vue-Powered Static Site Generator
https://vuepress.vuejs.org
MIT License
2.36k stars 923 forks source link

[Bug report] When the page path includes `hash`/ `query`, the page will load a 404 error. #1561

Closed pengzhanbo closed 6 months ago

pengzhanbo commented 6 months ago

Description

After upgrading from rc.9 to rc.11, there was a change in beforeResolve where the path comparison switched from to.path to to.fullpath.

However, to.fullpath includes the hash portion, which causes issues when the page is first loaded or when navigating to a page with a hash in the path, resulting in the inability to match the correct route and leading to a 404 error.

image

Reproduction

-

Used Package Manager

pnpm

System Info

vuepress: 2.0.0-rc.11 => 2.0.0-rc.11
digital-codes commented 6 months ago

Just discovered a probably related bug. Using url query parameters like ?id=1 leads to a 404 as well. Install a fresh vuepress with cli and npm. Error occurs with any query string

Previous versions worked like so: https://vp2.akugel.de/news.html?id=1 Now is broken

pengzhanbo commented 6 months ago

Just discovered a probably related bug. Using url query parameters like ?id=1 leads to a 404 as well. Install a fresh vuepress with cli and npm. Error occurs with any query string

Previous versions worked like so: vp2.akugel.de/news.html?id=1 Now is broken

I have also noticed this issue, and I will fix it together in the PR #1562 .