summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-02-19 15:11:03 +0100
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2017-01-31 22:53:58 +0000
commit492627c987fd167c956df49843e741cbe29fd77a (patch)
tree90156cbe7df8195569ed66926ccb2303b29332bd /app/models/project.rb
parentc089f103342ae8f60c7fa9055ef79e3245d6a5fb (diff)
downloadgitlab-ce-492627c987fd167c956df49843e741cbe29fd77a.tar.gz
Fix the URL of group pages
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb10
1 files changed, 7 insertions, 3 deletions
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}"