Skip to content

Commit

Permalink
fix: regression from #1123
Browse files Browse the repository at this point in the history
Since we are building the regex with `new RegExp`, the escapes must be
double-escaped. Instead of `\.` to esape the period, we need `\\.`.
Because that was not done, we were simply checking for *any* character,
instead of a literal period.
  • Loading branch information
tech4him1 committed Jul 30, 2018
1 parent 927ad28 commit 74f9429
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/netlify-cms-core/src/reducers/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const selectors = {
return `${ collection.get('folder').replace(/\/$/, '') }/${ slug }.${ this.entryExtension(collection) }`;
},
entrySlug(collection, path) {
return path.split('/').pop().replace(new RegExp(`\.${ escapeRegExp(this.entryExtension(collection)) }$`), '');
return path.split('/').pop().replace(new RegExp(`\\.${ escapeRegExp(this.entryExtension(collection)) }$`), '');
},
listMethod() {
return 'entriesByFolder';
Expand Down

0 comments on commit 74f9429

Please sign in to comment.