fix: link email validate format regex
This commit is contained in:
@@ -28,7 +28,7 @@ module App::Controllers::Link
|
||||
link.user = user
|
||||
|
||||
loop do
|
||||
slug = Random::Secure.urlsafe_base64(4).gsub(/[^a-zA-Z0-9]/, "")
|
||||
slug = Random::Secure.urlsafe_base64(5).gsub(/[^a-zA-Z0-9]/, "")
|
||||
if !Database.get_by(Link, slug: slug)
|
||||
link.slug = slug
|
||||
break
|
||||
|
||||
+1
-1
@@ -17,6 +17,6 @@ module App::Models
|
||||
unique_constraint :slug
|
||||
|
||||
validate_required [:slug, :url]
|
||||
validate_format :url, /\A(?:https?:\/\/)?(?:[\w-]+\.)+[\w-]+(?:\/\S*)?/
|
||||
validate_format :url, /\Ahttps?:\/\/(?:[\w.-]+)(?::\d+)?(?:[\/?#]\S*)?\z/i
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user