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

1.4 Broke rewrites #4261

Open
jasonkuhrt opened this issue Oct 9, 2024 · 2 comments
Open

1.4 Broke rewrites #4261

jasonkuhrt opened this issue Oct 9, 2024 · 2 comments
Labels
upstream Related to the dependencies

Comments

@jasonkuhrt
Copy link

Describe the bug

I use these rewrites in my Vitepress config:

rewrites: {
    ':section/{:_(\\d+_)}?:one/{:_(\\d+_)}?:two/{:_(\\d+_)}?:three'   : ':section/:one/:two/:three',
    ':section/{:_(\\d+_)}?:one/{:_(\\d+_)}?:two'                      : ':section/:one/:two',
    ':section/{:_(\\d+_)}?:one'                                       : ':section/:one'
  },

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.

CleanShot 2024-10-09 at 10 23 25@2x

Expected behavior

I expected that a minor release of Vitepress would not break the config.

System Info

System:
    OS: macOS 15.0
    CPU: (8) arm64 Apple M1 Pro
    Memory: 78.25 MB / 32.00 GB
    Shell: 3.5.0 - /opt/homebrew/bin/fish
  Binaries:
    Node: 22.7.0 - ~/Library/pnpm/node
    npm: 10.8.2 - ~/Library/pnpm/npm
    pnpm: 9.12.1 - /opt/homebrew/bin/pnpm
  Browsers:
    Brave Browser: 114.1.52.122
    Chrome: 129.0.6668.91
    Safari: 18.0
  npmPackages:
    vitepress: ^1.3.4 => 1.3.4 


### Additional context

_No response_

### Validations

- [X] Check if you're on the [latest VitePress version](https://github.com/vuejs/vitepress/releases/latest).
- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)
- [X] Read the [docs](https://vitepress.dev).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@jasonkuhrt jasonkuhrt added the bug: pending triage Maybe a bug, waiting for confirmation label Oct 9, 2024
@brc-dd
Copy link
Member

brc-dd commented Oct 9, 2024

path-to-regexp had a vulnerability. Their fix broke your rewrite patterns somehow - pillarjs/path-to-regexp#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.

@brc-dd brc-dd added upstream Related to the dependencies and removed bug: pending triage Maybe a bug, waiting for confirmation labels Oct 9, 2024
@yshrsmz
Copy link

yshrsmz commented Oct 9, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream Related to the dependencies
Projects
None yet
Development

No branches or pull requests

3 participants