Merge branch '28260-fix-pages-custom-domain-url' into 'master'

Resolve "Fix wrong output protocol pattern when adding custom domain to Pages"

Closes #28260

See merge request gitlab-org/gitlab-ce!16279
This commit is contained in:
Grzegorz Bizon 2018-01-08 15:54:59 +00:00
commit 166e9f8fba
3 changed files with 7 additions and 2 deletions

View file

@ -27,7 +27,7 @@ class PagesDomain < ActiveRecord::Base
def url
return unless domain
if certificate
if certificate.present?
"https://#{domain}"
else
"http://#{domain}"

View file

@ -0,0 +1,5 @@
---
title: Generate HTTP URLs for custom Pages domains when appropriate
merge_request: 16279
author:
type: fixed

View file

@ -68,7 +68,7 @@ describe PagesDomain do
subject { domain.url }
context 'without the certificate' do
let(:domain) { build(:pages_domain) }
let(:domain) { build(:pages_domain, certificate: '') }
it { is_expected.to eq('http://my.domain.com') }
end