From 492627c987fd167c956df49843e741cbe29fd77a Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Fri, 19 Feb 2016 15:11:03 +0100 Subject: Fix the URL of group pages --- app/models/project.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'app/models/project.rb') diff --git a/app/models/project.rb b/app/models/project.rb index dac52a0fc5e..73a642e1580 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1167,12 +1167,16 @@ class Project < ActiveRecord::Base def pages_url return unless Dir.exist?(public_pages_path) - host = "#{namespace.path}.#{Settings.pages.host}" + # The hostname always needs to be in downcased + # All web servers convert hostname to lowercase + host = "#{namespace.path}.#{Settings.pages.host}".downcase + + # The host in URL always needs to be downcased url = Gitlab.config.pages.url.sub(/^https?:\/\//) do |prefix| "#{prefix}#{namespace.path}." - end + end.downcase - # If the project path is the same as host, leave the short version + # If the project path is the same as host, we serve it as group page return url if host == path "#{url}/#{path}" -- cgit v1.2.1