Skip to content

Bug: Test reports artifact download append link with double relative URL

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

A US Federal customer discovered that when GitLab is configured under a relative URL, downloading test information attachments throws a 404 on /group/project/-/jobs/<job-id>/artifacts.

Steps to reproduce

  1. Configure GitLab under a relative URL (I.e. /gitlab)
  2. Create a project that generates test/unit reports
  3. Visit /group/project/-/pipelines/<pipeline-id>/test_report
  4. Click 'view details'
  5. Attempt to download attachment in pop-up

Example Project

What is the current bug behavior?

When downloading attachments from test/unit reports, GitLab throws a 404, appending the download link like so: /gitlab/gitlab/group/project/-/jobs/<job-id>/artifacts/.

What is the expected correct behavior?

The download link renders the relative URL and downloads successfully: /gitlab/group/project/-/jobs/<job-id>/artifacts/

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

I believe this occurs here, specifically when setting path: app/helpers/routing/artifacts_helper.rb#L23-31

Edited by 🤖 GitLab Bot 🤖