mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 22:27:49 +08:00
FIX: Allow multiple hyphens in host (#10078)
* FIX: Allow multiple hyphens in host * FIX: added spec for multiple hyphens
This commit is contained in:
@ -61,7 +61,7 @@ class EmbeddableHost < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def host_must_be_valid
|
||||
if host !~ /\A[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,24}(:[0-9]{1,5})?(\/.*)?\Z/i &&
|
||||
if host !~ /\A[a-z0-9]+([\-\.]+{1}[a-z0-9]+)*\.[a-z]{2,24}(:[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'))
|
||||
|
Reference in New Issue
Block a user