Skip to content

fix: correct regex for folder names containing 'index'#3271

Open
RamiNoodle733 wants to merge 1 commit intoevidence-dev:mainfrom
RamiNoodle733:fix-index-folder-regex
Open

fix: correct regex for folder names containing 'index'#3271
RamiNoodle733 wants to merge 1 commit intoevidence-dev:mainfrom
RamiNoodle733:fix-index-folder-regex

Conversation

@RamiNoodle733
Copy link

Bug Description

When a page folder name contains the word "index" (e.g., something-momentum-index), the build fails because the route generation logic incorrectly strips "index" from the folder name, not just from the index.md filename.

Root Cause

The regex /\/?index/g removes all occurrences of "index" from the entire path, not just the trailing /index from the filename.

Solution

Changed the regex from /\/?index/g to /\/?index$/ to only match /index at the end of the path.

Changes

  • Modified sites/example-project/src/pages/api/[...route]/evidencemeta.json/+server.js to fix the regex

Fixes #3263

The regex /\/?index/g was removing all occurrences of 'index' from the
entire path, not just the trailing '/index' from the filename. This caused
folder names containing 'index' (e.g., 'something-momentum-index') to be
corrupted during build.

Changed to /\/?index$/ to only match '/index' at the end of the path.

Fixes evidence-dev#3263
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.

[Bug]: Folder names containing "index" are corrupted during build due to aggressive regex in route generation

1 participant