Skip to content

Commit

Permalink
Fix: % symbol crash (#2267)
Browse files Browse the repository at this point in the history
  • Loading branch information
thewahome committed Dec 9, 2022
1 parent 8a7e29e commit 89851d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/modules/validation/abnf.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ const validUrls = [

const invalidUrls = [
'https://graph.microsoft.com/me+you',
'https://graph.microsoft.com/v1.0/me/messages?$$select=id'
'https://graph.microsoft.com/v1.0/me/messages?$$select=id',
'https://graph.microsoft.com/v1.0/me/drive/root:/Encoded%',
'https://graph.microsoft.com/v1.0/me/drive/root:/Encoded%2'
];

/*
Expand Down
4 changes: 3 additions & 1 deletion src/modules/validation/abnf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ export class ValidatedUrl {
}

public validate(graphUrl: string): ValidationResult {
let decodedGraphUrl = graphUrl;
try { decodedGraphUrl = decodeURI(graphUrl); } catch (error) { /* empty */ }
const result = ValidatedUrl.parser.parse(
ValidatedUrl.getGrammar(),
'odataUri',
decodeURI(graphUrl)
decodedGraphUrl
);
return result;
}
Expand Down

0 comments on commit 89851d7

Please sign in to comment.