From 5f47603b0766ef8c32d475ab5a9e99082fad25a0 Mon Sep 17 00:00:00 2001 From: jloh Date: Sat, 15 Apr 2017 21:06:51 +1000 Subject: [PATCH] FIX: increase host_must_be_valid regex for .technology TLD .technology is 11 chars long and wasn't being matched previously --- app/models/embeddable_host.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/embeddable_host.rb b/app/models/embeddable_host.rb index f94ce56b1b8..1bcd29af021 100644 --- a/app/models/embeddable_host.rb +++ b/app/models/embeddable_host.rb @@ -39,7 +39,7 @@ class EmbeddableHost < ActiveRecord::Base private def host_must_be_valid - if host !~ /\A[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,7}(:[0-9]{1,5})?(\/.*)?\Z/i && + if host !~ /\A[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,10}(:[0-9]{1,5})?(\/.*)?\Z/i && host !~ /\A(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})(:[0-9]{1,5})?(\/.*)?\Z/ && host !~ /\A([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.)?localhost(\:[0-9]{1,5})?(\/.*)?\Z/i errors.add(:host, I18n.t('errors.messages.invalid'))