-
-
Notifications
You must be signed in to change notification settings - Fork 784
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
Added Validation for formState.link in advertisementRegister #1482
Conversation
Our Pull Request Approval ProcessWe have these basic policies to make the approval process smoother for our volunteer team. Testing Your CodePlease make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:
The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing. ReviewersWhen your PR has been assigned reviewers contact them to get your code reviewed and approved via:
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
src/utils/linkValidator.ts
Outdated
export const isValidLink = (link: string): boolean => { | ||
const pattern = new RegExp( | ||
'^(https?:\\/\\/)?' + | ||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
Updated the PR resolving the Screen.Recording.2024-01-27.at.12.17.32.AM.mov |
We have a policy of unassigning contributors who close PRs without getting validation from our reviewer team. This is because:
Please be considerate of our volunteers' limited time and our desire to improve our code base. This policy is stated as a pinned post in all our Talawa repositories. Our YouTube videos explain why this practice is not acceptable to our Community. |
Apologies for any inconvenience caused. I understand the importance of following the established policy and will ensure that PRs are not closed without validation from the reviewer team moving forward. |
What kind of change does this PR introduce?
This pull request introduces a
isValidLink()
function to validate the link entered when creating an advertisement.Issue Number:
Fixes #1479
Did you add tests for your changes?
No
Snapshots/Videos:
Untitled.mp4
If relevant, did you update the documentation?
No(not required)
Summary
Currently the user is allowed to input random strings or potentially invalid data in the formState.link. So, this PR fixes the issue by first validating if the formState.link is actually a link before creating a new advertisement.
Does this PR introduce a breaking change?
No
Other information
Have you read the contributing guide?
Yes