diff options
author | Drew Blessing <drew@gitlab.com> | 2017-05-19 09:07:38 -0500 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-06-06 12:39:37 +0100 |
commit | 8df7bcf532c9f0407fcefa12d205cb9d160fe5f4 (patch) | |
tree | ce364bd558bf02371e6fc5be269fda72d6c48c85 /app | |
parent | e34e5761042579686fe149f16e7ec107b80224d2 (diff) | |
download | gitlab-ce-8df7bcf532c9f0407fcefa12d205cb9d160fe5f4.tar.gz |
Allow numeric pages domain
Previously, `PagesDomain` would not allow a domain such as
123.example.com. With this change, this is now allowed, because
it is a perfectly valid domain.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/pages_domain.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/pages_domain.rb b/app/models/pages_domain.rb index f2f2fc1e32a..5d798247863 100644 --- a/app/models/pages_domain.rb +++ b/app/models/pages_domain.rb @@ -1,7 +1,7 @@ class PagesDomain < ActiveRecord::Base belongs_to :project - validates :domain, hostname: true + validates :domain, hostname: { allow_numeric_hostname: true } validates :domain, uniqueness: { case_sensitive: false } validates :certificate, certificate: true, allow_nil: true, allow_blank: true validates :key, certificate_key: true, allow_nil: true, allow_blank: true @@ -98,7 +98,7 @@ class PagesDomain < ActiveRecord::Base def validate_pages_domain return unless domain - if domain.downcase.ends_with?(".#{Settings.pages.host}".downcase) + if domain.downcase.ends_with?(Settings.pages.host.downcase) self.errors.add(:domain, "*.#{Settings.pages.host} is restricted") end end |