From 98f103f5cfb6dc5ab5f65ffc5eb2e33bf3be16ae Mon Sep 17 00:00:00 2001 From: Juan Rodriguez Date: Wed, 31 Jul 2024 21:38:57 +0200 Subject: [PATCH] fix: url validate format --- app/models/link.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/link.cr b/app/models/link.cr index c2b99f0..c0bec23 100644 --- a/app/models/link.cr +++ b/app/models/link.cr @@ -17,6 +17,6 @@ module App::Models unique_constraint :slug validate_required [:slug, :url] - validate_format :url, /\Ahttps?:\/\/(?:[\w.-]+)(?::\d+)?(?:[\/?#]\S*)?\z/i + validate_format :url, /\A(?:(https?:\/\/)?(?:[\w-]+\.)+[a-z]{2,})(?::\d+)?(?:[\/?#]\S*)?\z/i end end