Merge pull request #4759 from kennym/support-ports-for-ip-addresses-in-embedding

FIX: Allow ports for embed host IPs
This commit is contained in:
Robin Ward
2017-03-16 11:23:42 -04:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@@ -40,7 +40,7 @@ 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})(:[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'))
end