Absolute path to asset files
GitLab sets the paths to uploaded files with absolute URL incl. FQDN of the server.
Examples of using absolute paths:
- Profile images / avatars uploaded to the server (see #975 (closed))
- If there is no avatar uploaded, an absolute URL is used like https://gitlab.com/assets/no_avatar-0b64d25ac5f63e6f0caee99e819105ba.png
- Uploaded files in issues are set with absolute path name containing the FQDN of the GitLab server, e.g. just the txt file uploaded here: test.txt
- Uploaded project files (e.g. logos)
Using absolute paths is a problem, if you connect to GitLab via SSH tunnels, e.g. on a different port than 80 or 443 (see #975 (closed)). All assets which are embedded into HTML by absolute paths incl. FQDN are broken. So, for usage within intranets and to align to most web services I've seen, using relative paths to the assets would be very welcome!
For the user profile and project images I have created a workaround by just changing the code a bit e.g. in gitlab/app/models/user.rb (remove the gitlab_config.url):
def avatar_url(size = nil)
if avatar.present?
#[gitlab_config.url, avatar.url].join
avatar.url
else
GravatarService.new.execute(email, size)
end
end