mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-24 20:00:39 -04:00
fix(curriculum): ObjectID filename detection (#56837)
This commit is contained in:
@@ -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}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user