Closed jasonkuhrt closed 1 month ago
path-to-regexp had a vulnerability. Their fix broke your rewrite patterns somehow - https://github.com/pillarjs/path-to-regexp/pull/324
This likely won't be fixed at source as it's a vulnerability patch not exactly a regression. You can use pnpm.overrides to lock it to ~6.2 (not recommended in long term). Or update your pattern to work with newer versions.
I had a similar problem.
I had this rewrites config
rewrites: {
'posts/:skipped/:year-:month-:day-:slug.md': ':year/:month/:day/:slug/index.md',
}
and now /posts/2018/2018-03-27-settingup-github-slack.md
becomes /2018-03-27/settingup/github/slack/index.html
.
It was once rewrited as /2018/03/27/settingup-github-slack/index.html
.
Edit: changing the pattern to posts/:skipped/:year-:month-:day-:slug(.*).md
fixed the issue for me.
I'm not sure this library is the best match for Vitepress. The security issue in question is not relevant for a static site generator is it?
May I ask that you add the option for a function to be passed to rewrite paths? I've already struggled to use the existing approach and not sure how to fix it now. The version Vitepress uses is not the latest, its docs are not what's currently on the latest readme but rather I have to find older commits. All of this for me is just extra work versus having a function I could just implement what I want.
Would that be doable or does the currently declarative approach have deeply dependent internals?
Yeah we can support passing a function 👀
Will be out in next version.
@brc-dd thanks that's great to hear! Looking forward to it.
Released. Should I close this issue? I don't think we can do much about path-to-regexp breaking edge cases from vitepress' side. And I also updated the docs to link to it's v6 version. We won't update it to v8 till our next major 👀
Yep sounds good let's close!
Describe the bug
I use these rewrites in my Vitepress config:
Reproduction
I have a failing case right now on this PR, example build failure: https://github.com/jasonkuhrt/graffle/actions/runs/11219992004/job/31187185529?pr=1168.
Expected behavior
I expected that a minor release of Vitepress would not break the config.
System Info