-
Notifications
You must be signed in to change notification settings - Fork 769
Full-stack: Make "Server url" validation conditions consistent across Fleet, update Web Address form validation and submission logic per Fleet best practices (frontend/docs/patterns.md)
#27455
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
Changes from 19 commits
2c04413
880ab3e
5d91eb3
9044315
883400c
00efbad
66567e1
133ba40
2d12dc4
48b09b3
bc033b5
c70141f
3da6c59
05e0c06
7d39817
478820b
9b7a2f4
30ba820
d9e830f
7e48d93
d5ddf5e
312e7b2
96be402
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - Accept any string for the Fleet web URL | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,8 +6,16 @@ interface IValidUrl { | |
| url: string; | ||
| /** Validate protocols specified */ | ||
| protocols?: ("http" | "https")[]; | ||
| allowAnyLocalHost?: boolean; | ||
| } | ||
|
|
||
| export default ({ url, protocols }: IValidUrl): boolean => { | ||
| return isURL(url, { protocols }); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wasn't actually validating that the provided url uses one of the provided protocols |
||
| export default ({ | ||
| url, | ||
| protocols, | ||
| allowAnyLocalHost = false, | ||
| }: IValidUrl): boolean => { | ||
| if (allowAnyLocalHost && url.includes("localhost")) return true; | ||
|
||
| // this function also has a `require_valid_protocol` option, though as called it seems to already validate | ||
| // that the URL's protocol is one of those specified | ||
| return isURL(url, { protocols, require_protocol: !!protocols?.length }); | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.