Skip to content

bug fix: source-url cast into str and max_lenght validations

Surya Manoj Pentakota requested to merge source-url-bug-fix into develop

fix(source_url-validation): converts the source_url into string before inserting into database and max_length validations set

Pydantic's HttpUrl ignores max_length because it returns a url object rather than a raw string — so Field(max_length=...) has no effect. That can allow URLs longer than DB column limits and cause truncation or other runtime errors.

This MR adds an explicit validator that checks the string length of HttpUrl values and raises a ValueError when the URL exceeds the configured maximum. It preserves all built-in URL validation while enforcing length constraints.

Also converts the url object into string before inserting it into database which solves the SqlAlchemy insert error causing the 500 request response.

Checklist

  • The bug has been reproduced and confirmed.
  • A clear and concise fix has been implemented.
  • New tests have been added to prevent regressions.
  • Existing tests are passing.

Related Issue(s)

Closes #90 (closed)

Merge request reports

Loading