Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(toolkit): update mobileUriSchemeProtocolRegEx #5843

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/toolkit/core-kit/src/regex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const phoneRegEx = /^\d+$/;
export const phoneInputRegEx = /^\+?[\d-( )]+$/;
export const usernameRegEx = /^[A-Z_a-z]\w*$/;
export const webRedirectUriProtocolRegEx = /^https?:$/;
export const mobileUriSchemeProtocolRegEx = /^[a-z][\d+_a-z-]*(\.[\d+_a-z-]+)+:$/;
export const mobileUriSchemeProtocolRegEx = /^[\da-z][\d\.+_a-z-]*:$/;
export const hexColorRegEx = /^#[\da-f]{3}([\da-f]{3})?$/i;
export const dateRegex = /^\d{4}(-\d{2}){2}/;
export const noSpaceRegEx = /^\S+$/;
Expand Down
4 changes: 2 additions & 2 deletions packages/toolkit/core-kit/src/utils/url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ describe('url utilities', () => {
expect(validateRedirectUrl('https://logto.dev/callback', 'web')).toBeTruthy();
expect(validateRedirectUrl('https://my-company.com/callback?test=123', 'web')).toBeTruthy();
expect(validateRedirectUrl('https://abc.com/callback?test=123#param=hash', 'web')).toBeTruthy();
expect(validateRedirectUrl('logto://my-app/callback', 'mobile')).toBeTruthy();
expect(validateRedirectUrl('io.logto://my-app/callback', 'mobile')).toBeTruthy();
expect(validateRedirectUrl('1app://', 'mobile')).toBeTruthy();
expect(validateRedirectUrl('com.company://myDemoApp/callback', 'mobile')).toBeTruthy();
expect(validateRedirectUrl('com.company://demo:1234', 'mobile')).toBeTruthy();
expect(validateRedirectUrl('io.logto.SwiftUI-Demo://callback', 'mobile')).toBeTruthy();
Expand All @@ -20,8 +22,6 @@ describe('url utilities', () => {
expect(validateRedirectUrl('ws://com.company://demo:1234', 'web')).toBeFalsy();
expect(validateRedirectUrl('abc.com', 'web')).toBeFalsy();
expect(validateRedirectUrl('abc.com', 'mobile')).toBeFalsy();
expect(validateRedirectUrl('http://localhost:3001', 'mobile')).toBeFalsy();
expect(validateRedirectUrl('https://logto.dev/callback', 'mobile')).toBeFalsy();
expect(validateRedirectUrl('demoApp/callback', 'mobile')).toBeFalsy();
});

Expand Down
Loading