Skip to content

Commit

Permalink
Make sure autocomplete triggers are regex safe (#10785)
Browse files Browse the repository at this point in the history
  • Loading branch information
notnownikki authored Oct 19, 2018
1 parent 0e155bd commit ab9b4a2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/components/src/autocomplete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ export class Autocomplete extends Component {
return;
}

const match = text.match( new RegExp( `${ open.triggerPrefix }(\\w*)$` ) );
const safeTrigger = escapeRegExp( open.triggerPrefix );
const match = text.match( new RegExp( `${ safeTrigger }(\\w*)$` ) );
const query = match && match[ 1 ];
const { open: wasOpen, suppress: wasSuppress, query: wasQuery } = this.state;

Expand Down

0 comments on commit ab9b4a2

Please sign in to comment.