From e9db03e465998dba5520b926e75042ecae8cb9bc Mon Sep 17 00:00:00 2001 From: Acshi Haggenmiller Date: Fri, 22 Jul 2016 15:33:21 -0400 Subject: [PATCH] allow localhost as an embeddedable host --- app/models/embeddable_host.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/embeddable_host.rb b/app/models/embeddable_host.rb index ffa1005c6..d42879ad9 100644 --- a/app/models/embeddable_host.rb +++ b/app/models/embeddable_host.rb @@ -25,7 +25,8 @@ class EmbeddableHost < ActiveRecord::Base 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 && - host !~ /\A(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\Z/ + host !~ /\A(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\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')) end end