Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #60 from TimoGlastra/fix/parse-scheme-with-number
Browse files Browse the repository at this point in the history
fix: parse scheme with number
  • Loading branch information
nklomp authored Sep 28, 2023
2 parents ca508e3 + 0f90226 commit 4d1b1dc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/authorization-request/URI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class URI implements AuthorizationRequestURI {
throw Error(SIOPErrors.BAD_PARAMS);
}
// We strip the uri scheme before passing it to the decode function
const scheme: string = uri.match(/^([a-zA-Z-_]+:\/\/)/g)[0];
const scheme: string = uri.match(/^([a-zA-Z][a-zA-Z0-9-_]*:\/\/)/g)[0];
const authorizationRequestPayload = decodeUriAsJson(uri) as AuthorizationRequestPayload;
return { scheme, authorizationRequestPayload };
}
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/Encodings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function decodeUriAsJson(uri: string) {
if (!uri) {
throw new Error(SIOPErrors.BAD_PARAMS);
}
const queryString = uri.replace(/^([a-zA-Z-_]+:\/\/[?]?)/g, '');
const queryString = uri.replace(/^([a-zA-Z][a-zA-Z0-9-_]*:\/\/[?]?)/g, '');
if (!queryString) {
throw new Error(SIOPErrors.BAD_PARAMS);
}
Expand Down

0 comments on commit 4d1b1dc

Please sign in to comment.