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

validate url of Add data modal #1837

Merged
merged 5 commits into from Jun 1, 2022
Merged

Conversation

jagerts
Copy link
Collaborator

@jagerts jagerts commented May 26, 2022

  • add removed styles of Add data modal
  • add validation to url input

Signed-off-by: Evgeny Zhgulev <evgeny.zhgulev@actionengine.com>
Signed-off-by: Evgeny Zhgulev <evgeny.zhgulev@actionengine.com>
@jagerts jagerts requested a review from heshan0131 May 26, 2022 18:03
* @param str
*/
export function validateUrl(str) {
return str?.match(/^(ftp|https?):\/\/+(www\.)?[a-z0-9\-\.]{3,}\.[a-z]{3}$/);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should also allow http://

Signed-off-by: Evgeny Zhgulev <evgeny.zhgulev@actionengine.com>
Signed-off-by: Evgeny Zhgulev <evgeny.zhgulev@actionengine.com>
@jagerts jagerts merged commit 9bee093 into master Jun 1, 2022
@delete-merged-branch delete-merged-branch bot deleted the ez/remote-map-modal-validate-url branch June 1, 2022 11:20
* @param str
*/
export function validateUrl(str) {
return str?.match(/^(ftp|http|https?):\/\/+(www\.)?[a-z0-9\-\.]{3,}\.[a-z]{3}$/);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This regex only allows URLs with an empty path (allows https://uber.com but not https://uber.com/data.csv).

Additionally, it removes the option of using localhost as a domain.
And TLDs with only 2 letters (.es, .cl, etc).

I think this PR should be reverted

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants