mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
fix(curriculum): ObjectID filename detection (#56837)
This commit is contained in:
parent
76eae4effd
commit
63a4f08493
@ -275,12 +275,12 @@ function generateChallengeCreator(lang, englishPath, i18nPath) {
|
||||
({ id }) => id === challenge.id
|
||||
);
|
||||
|
||||
const isObjectIdFilename = /[a-z0-9]{24}\.md$/.test(englishPath);
|
||||
const isObjectIdFilename = /\/[a-z0-9]{24}\.md$/.test(englishPath);
|
||||
if (isObjectIdFilename) {
|
||||
const filename = englishPath.split('/').pop();
|
||||
if (filename !== `${challenge.id}.md`) {
|
||||
throw Error(
|
||||
`Filename ${filename} does not match challenge id ${challenge.id}`
|
||||
`Filename matches MongoDB ObjectID pattern, but ${filename} does not match challenge id ${challenge.id}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user