Using an external_url with sub-domain leads to 404 on email header logos

Summary

Notification emails have 404 on header image path path when using a sub-domain external_url

What is the current bug behavior?

If external_url has been set to point to a sub-domain (such as http://abc.xyz/gitlab), any forgot password emails have the correct link addresses in the body (e.g. http://abc.xyz/gitlab/users/password/edit?reset_password_token=blah) but the gitlab header image uses the path without the sub-domain.

For example, in the e-mail I receive, the <img> tag has src="http://abc.xyz/assets/mailers/gitlab_header_logo-foobar.png". Notice that /gitlab/ is missing from the src. This means that gitlab's logo is not rendered (404). Manually trying to access http://abc.xyz/gitlab/assets/mailers/gitlab_header_logo-foobar.png (with /gitlab/ added) shows the logo

What is the expected correct behavior?

The header image source should also have full external_url in path just like all the other links in the page

Relevant logs and/or screenshots

HTML fragment of the mail received

<img id="logo" alt="GitLab Wordmark" src="http://abc.xyz/assets/mailers/gitlab_header_logo-7b032538605d1f784a95faac7e0524e9099462bc276424c1a951902ea2528522.png" style="border: none; min-height: 88px; outline: none; width: 134px">
</td>
</table>
<table id="body" style="-premailer-cellpadding: 0; -premailer-cellspacing: 0; background: #fafafa; border: 1px solid #000; border-collapse: separate; border-radius: 4px; margin: 0 auto; width: 600px" bgcolor="#fafafa" cellpadding="0" cellspacing="0">
<tr>
<td id="body-container" style="padding: 20px 40px">
<div class="center" style="text-align: center" align="center">
<div id="content">
<h2 style="color: #6b4fbb; font-size: 30px; font-weight: 400; line-height: 34px; margin-top: 0">Hello, Dheeraj Gupta!</h2>
<p style="color: #444; font-size: 17px; line-height: 24px; margin-bottom: 0">
Someone, hopefully you, has requested to reset the password for your
GitLab account on <a href="http://abc.xyz/gitlab">http://abc.xyz/gitlab</a>.

Results of GitLab environment info

System information System: Current User: git Using RVM: no Ruby Version: 2.3.3p222 Gem Version: 2.6.6 Bundler Version:1.13.7 Rake Version: 10.5.0 Redis Version: 3.2.5 Sidekiq Version:4.2.7

GitLab information Version: 8.17.5 Revision: 2e93947 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: http://abc.xyz/gitlab HTTP Clone URL: http://abc.xyz/gitlab/some-group/some-project.git SSH Clone URL: git@abc.xyz:some-group/some-project.git Using LDAP: no Using Omniauth: no

GitLab Shell Version: 4.1.1 Repository storage paths:

  • default: /gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/ Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Checking GitLab Shell ...

GitLab Shell version >= 4.1.1 ? ... OK (4.1.1) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 3/1 ... ok 2/2 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK Send ping to redis server: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured with autocrlf=input? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config outdated? ... no Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory setup correctly? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) projects have namespace: ... 3/1 ... yes 2/2 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.1.0 ? ... yes (2.3.3) Your git bin path is "/opt/gitlab/embedded/bin/git" Git version >= 2.7.3 ? ... yes (2.10.2) Active users: 3

Checking GitLab ... Finished

Possible fixes

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/helpers/emails_helper.rb#L63 probably handles the default logo