Skip to content

Commit

Permalink
feat: allow tld in ValidURL with 63 characters (#260)
Browse files Browse the repository at this point in the history
Fix for Issue #259

Co-authored-by: Roland Manfrahs <[email protected]>
  • Loading branch information
rolman243 and Roland Manfrahs authored Aug 24, 2024
1 parent 37b8266 commit 0257136
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main/src/io/github/iltotore/iron/constraint/string.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ object string:
*/
type ValidURL =
Match[
"((\\w+:)+\\/\\/)?(([-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6})|(localhost))(:\\d{1,5})?(\\/|\\/([-a-zA-Z0-9@:%_\\+.~#?&//=]*))?"
"((\\w+:)+\\/\\/)?(([-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,63})|(localhost))(:\\d{1,5})?(\\/|\\/([-a-zA-Z0-9@:%_\\+.~#?&//=]*))?"
] DescribedAs "Should be an URL"

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ object StringSuite extends TestSuite:
test - "http://example.com/#section".assertRefine[ValidURL]
test - "http://example.com/?q=with%20space".assertRefine[ValidURL]
test - "http://example.com/?q=with+space".assertRefine[ValidURL]
test - "https://aaaaa-bbb-cccccc-dddddddd.eeeeeeee-fff.ggg.hhhhhhhhh:1234".assertRefine[ValidURL]
test - "/example.com".assertNotRefine[ValidURL]
test - "://example.com".assertNotRefine[ValidURL]
test - "http:///".assertNotRefine[ValidURL]
Expand Down

0 comments on commit 0257136

Please sign in to comment.