Adding project badge fails with relative URL
Summary
Trying to add a badge in project settings always fails although link and badge image url are correctly working.
Steps to reproduce
Start gitlab-ce with docker adding a custom base url using "external_url" parameter like:
docker run --detach \
--hostname example.com \
--publish 443:443 \
--publish 2222:22 \
--env GITLAB_OMNIBUS_CONFIG="external_url 'https://example.com/gitlab'" \
--restart always \
--name gitlab \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
gitlab/gitlab-ce:latest
What is the current bug behavior?
Adding ad badge on https://example.com/gitlab/group/project/settings/badges with link url like https://example.com/gitlab/group/project/ and and image url like https://example.com/gitlab/group/project/badges/master/pipeline.svg fails.
In the browser console you will see a POST request to https://example.com/api/v4/projects/1/badges. This is not a typo here, the custom path is missing.
What is the expected correct behavior?
The POST request should go to https://example.com/gitlab/api/v4/projects/1/badges, the urls should be accepted and a new bagde should be added.
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Current User: git Using RVM: no Ruby Version: 2.3.6p384 Gem Version: 2.6.13 Bundler Version:1.13.7 Rake Version: 12.3.0 Redis Version: 3.2.11 Git Version: 2.14.3 Sidekiq Version:5.0.5 Go Version: unknownGitLab information Version: 10.7.3 Revision: 2555d6c Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://example.com/gitlab HTTP Clone URL: https://example.com/gitlab/some-group/some-project.git SSH Clone URL: [git@example.com:2222]:some-group/some-project.git Using LDAP: no Using Omniauth: no
GitLab Shell Version: 7.1.2 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab Shell ...GitLab Shell version >= 7.1.2 ? ... OK (7.1.2) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 3/1 ... ok 3/2 ... ok 3/3 ... ok 3/4 ... ok 3/5 ... ok 3/6 ... ok 3/7 ... ok 3/8 ... ok 3/9 ... ok 3/10 ... ok 3/11 ... ok 3/12 ... ok 3/13 ... ok 3/14 ... ok 3/15 ... ok 3/16 ... ok 3/17 ... ok 12/18 ... ok 3/19 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... 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 3/2 ... yes 3/3 ... yes 3/4 ... yes 3/5 ... yes 3/6 ... yes 3/7 ... yes 3/8 ... yes 3/9 ... yes 3/10 ... yes 3/11 ... yes 3/12 ... yes 3/13 ... yes 3/14 ... yes 3/15 ... yes 3/16 ... yes 3/17 ... yes 12/18 ... yes 3/19 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.3.6) Git version >= 2.9.5 ? ... yes (2.14.3) Git user has default SSH configuration? ... yes Active users: ... 9
Checking GitLab ... Finished