|
@@ -28,7 +28,8 @@ export default class PagePath extends React.Component {
|
|
|
const page = this.props.page;
|
|
const page = this.props.page;
|
|
|
const pagePath = page.path.replace(this.props.excludePathString.replace(/^\//, ''), '');
|
|
const pagePath = page.path.replace(this.props.excludePathString.replace(/^\//, ''), '');
|
|
|
const shortPath = this.getShortPath(pagePath);
|
|
const shortPath = this.getShortPath(pagePath);
|
|
|
- const pathPrefix = pagePath.replace(new RegExp(shortPath + '(/)?$'), '');
|
|
|
|
|
|
|
+ const shortPathEscaped = shortPath.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
|
|
|
+ const pathPrefix = pagePath.replace(new RegExp(shortPathEscaped + '(/)?$'), '');
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<span className="page-path">
|
|
<span className="page-path">
|