Skip to content

fix: correct URL validation and centralize logic #421

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

Merged
merged 6 commits into from
Jul 22, 2025

Conversation

ssncferreira
Copy link
Contributor

Description

Fixes incorrect URL validation logic previously used in URL definitions, where the attribute label (s) was being parsed instead of the actual value. This bug caused invalid URLs to be silently accepted.

Additionally, this PR introduces a shared ValidateURL helper function to remove duplication and ensure consistent behavior across all URL fields.

Changes

  • Fixed incorrect use of url.Parse(s), now validating the actual value.
  • Added ValidateURL helper function for consistent and reusable validation.
  • Updated all schema definitions that perform URL validation to use ValidateURL.
  • Adjusted tests to match the corrected validation logic.

@ssncferreira ssncferreira force-pushed the ssncferreira/fix-url-validation branch from 5a69fcb to f8556e8 Compare July 21, 2025 16:23
@ssncferreira ssncferreira force-pushed the ssncferreira/fix-url-validation branch from f8556e8 to 38bc617 Compare July 21, 2025 16:27
@ssncferreira ssncferreira marked this pull request as ready for review July 21, 2025 19:35
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

LGTM!

@ssncferreira ssncferreira merged commit d5496af into main Jul 22, 2025
8 of 9 checks passed
@ssncferreira ssncferreira deleted the ssncferreira/fix-url-validation branch July 22, 2025 12:19
@github-actions github-actions bot locked and limited conversation to collaborators Jul 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants