Skip to content

Commit

Permalink
Fix: terminate process on entering multiple slash (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezkemboi authored Jul 12, 2021
1 parent 88a2018 commit adbbc9f
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ class AutoComplete extends Component<IAutoCompleteProps, IAutoCompleteState> {
};

private initialiseAutoComplete = (url: string) => {
const isSlashPreceed = url.substring(url.length - 1, url.length - 2);
if (isSlashPreceed === '/') {
return;
}
switch (getLastCharacterOf(url)) {
case '/':
case '?':
Expand Down Expand Up @@ -181,20 +185,12 @@ class AutoComplete extends Component<IAutoCompleteProps, IAutoCompleteState> {
};

public displayLinkOptions = () => {
const { compare } = this.state;
const parametersWithVerb = getParametersWithVerb(this.props);
if (!parametersWithVerb) {
return;
}

let filteredSuggestions = parametersWithVerb.links;
if (compare) {
filteredSuggestions = filteredSuggestions.filter((suggestion: string) => {
return suggestion.toLowerCase().indexOf(compare.toLowerCase()) > -1;
});
}

this.setSuggestions(filteredSuggestions);
this.setSuggestions(parametersWithVerb.links);
}

public getQueryParameters = () => {
Expand Down

0 comments on commit adbbc9f

Please sign in to comment.