Skip to content

Commit

Permalink
Fix: Support unicode characters (#2758)
Browse files Browse the repository at this point in the history
  • Loading branch information
thewahome authored Sep 7, 2023
1 parent 266b6ff commit 46353fa
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,21 @@ function getErrorMessage(queryUrl: string) {
if (error) {
return `${translateMessage('Possible error found in URL near')}: ${error}`;
}
if (queryUrl.indexOf('graph.microsoft.com') === -1){
if (queryUrl.indexOf('graph.microsoft.com') === -1) {
return translateMessage('The URL must contain graph.microsoft.com');
}
return '';
}

function getValidationError(queryUrl: string): string | null {
const validator = new ValidatedUrl();
const validation = validator.validate(queryUrl);
if (!validation.success) {
return queryUrl.substring(validation.matched, validation.maxMatched);
try {
const validator = new ValidatedUrl();
const validation = validator.validate(queryUrl);
return (!validation.success) ?
queryUrl.substring(validation.matched, validation.maxMatched) : null;
} catch (error) {
return null;
}
return null;
}

function getSearchText(input: string, index: number) {
Expand Down

0 comments on commit 46353fa

Please sign in to comment.