Skip to content

Commit

Permalink
Strip entire extension from slug, not just last extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
tech4him1 committed Feb 21, 2018
1 parent f6293b0 commit e2f8d49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/reducers/collections.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { OrderedMap, fromJS } from 'immutable';
import { has, get } from 'lodash';
import { has, get, escapeRegExp } from 'lodash';
import consoleError from 'Lib/consoleError';
import { CONFIG_SUCCESS } from 'Actions/config';
import { FILES, FOLDER } from 'Constants/collectionTypes';
Expand Down Expand Up @@ -57,7 +57,7 @@ const selectors = {
return `${ collection.get('folder').replace(/\/$/, '') }/${ slug }.${ this.entryExtension(collection) }`;
},
entrySlug(collection, path) {
return path.split('/').pop().replace(/\.[^\.]+$/, '');
return path.split('/').pop().replace(new RegExp(`\.${ escapeRegExp(this.entryExtension(collection)) }$`), '');
},
listMethod() {
return 'entriesByFolder';
Expand Down

0 comments on commit e2f8d49

Please sign in to comment.