-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fixed API typo and webhook checkerror (#6779)
## Issue 1.There was an Api typo with API under Developers section #6778 2. Webhook lacked an check method for the `TextInput` #6774 ## After- <img width="649" alt="Screenshot 2024-08-29 at 2 13 21 AM" src="https://github.com/user-attachments/assets/bc9595f8-533f-430e-bc18-56373983eec8"> https://github.com/user-attachments/assets/8e2b06bc-308a-48ad-8ecb-9d0a130877bc --------- Co-authored-by: Charles Bochet <[email protected]>
- Loading branch information
1 parent
96d659c
commit f889068
Showing
4 changed files
with
54 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/twenty-front/src/utils/url/__tests__/isValidUrl.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { isValidUrl } from '../isValidUrl'; | ||
|
||
describe('isValidUrl', () => { | ||
it('test cases', () => { | ||
// Truthy | ||
expect(isValidUrl('https://www.example.com')).toBe(true); | ||
expect(isValidUrl('http://192.168.2.0:3000')).toBe(true); | ||
expect(isValidUrl('http://localhost')).toBe(true); | ||
expect(isValidUrl('http://localhost:3000')).toBe(true); | ||
expect(isValidUrl('http://subdomain.example.com')).toBe(true); | ||
expect(isValidUrl('https://www.example.com/path')).toBe(true); | ||
expect(isValidUrl('https://www.example.com/path/path2?query=123')).toBe( | ||
true, | ||
); | ||
expect(isValidUrl('http://localhost:3000')).toBe(true); | ||
expect(isValidUrl('example.com')).toBe(true); | ||
expect(isValidUrl('www.subdomain.example.com')).toBe(true); | ||
|
||
// Falsy | ||
expect(isValidUrl('?o')).toBe(false); | ||
expect(isValidUrl('')).toBe(false); | ||
expect(isValidUrl('\\')).toBe(false); | ||
expect(isValidUrl('wwwexamplecom')).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export const isValidUrl = (url: string) => { | ||
const urlRegex = | ||
/^(https?:\/\/)?((([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,})|(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(localhost))(:\d+)?(\/[^\s]*)?(\?[^\s]*)?$/; | ||
|
||
const urlPattern = new RegExp(urlRegex, 'i'); | ||
|
||
return !!urlPattern.test(url); | ||
}; |