Commit 51f174b97f686397bc7299c16a64fda14d5bc718
1 parent
00ef16a6
Exists in
master
and in
4 other branches
fix port issue
Showing
2 changed files
with
12 additions
and
4 deletions
Show diff stats
app/mailers/notify.rb
| ... | ... | @@ -4,7 +4,7 @@ class Notify < ActionMailer::Base |
| 4 | 4 | |
| 5 | 5 | default_url_options[:host] = Gitlab.config.web_host |
| 6 | 6 | default_url_options[:protocol] = Gitlab.config.web_protocol |
| 7 | - default_url_options[:port] = Gitlab.config.web_port | |
| 7 | + default_url_options[:port] = Gitlab.config.web_port if Gitlab.config.web_custom_port? | |
| 8 | 8 | |
| 9 | 9 | default from: Gitlab.config.email_from |
| 10 | 10 | ... | ... |
config/initializers/1_settings.rb
| ... | ... | @@ -20,17 +20,25 @@ class Settings < Settingslogic |
| 20 | 20 | |
| 21 | 21 | def web_port |
| 22 | 22 | if web.https |
| 23 | - nil | |
| 23 | + web['port'] = 443 | |
| 24 | 24 | else |
| 25 | 25 | web['port'] ||= 80 |
| 26 | - end | |
| 26 | + end.to_i | |
| 27 | + end | |
| 28 | + | |
| 29 | + def web_custom_port? | |
| 30 | + ![443, 80].include?(web_port) | |
| 27 | 31 | end |
| 28 | 32 | |
| 29 | 33 | def build_url |
| 30 | 34 | raw_url = self.web_protocol |
| 31 | 35 | raw_url << "://" |
| 32 | 36 | raw_url << web_host |
| 33 | - raw_url << ":#{web_port}" if web_port.to_i != 80 | |
| 37 | + | |
| 38 | + if web_custom_port? | |
| 39 | + raw_url << ":#{web_port}" | |
| 40 | + end | |
| 41 | + | |
| 34 | 42 | raw_url |
| 35 | 43 | end |
| 36 | 44 | ... | ... |