Route Maps for environments with trailing slash have unexpected double slash (//) in path
Summary
Route Maps for environments with trailing slash have unexpected double slash (//) in path.
Steps to reproduce
.gitlab-ci.yml
:
environment:
url: 'https://my-domain.com/project-sub-path/'
And setup .gitlab/route-maps.yml
: https://docs.gitlab.com/ee/ci/review_apps/#route-maps-example
What is the current bug behavior?
Environment URL | Route Path | Final URL |
---|---|---|
https://my-domain.com/project-sub-path/ | my/route/path/match | https://my-domain.com/project-sub-path//my/route/path/match |
Notice the //
in project-sub-path//my/route/path/match
.
I find this on the Merge Request under the View App
:
Here's the structure of the HTML:
What is the expected correct behavior?
(What you should see instead)
Environment URL | Route Path | Final URL |
---|---|---|
https://my-domain.com/project-sub-path/ | my/route/path/match | https://my-domain.com/project-sub-path/my/route/path/match |
Replaces //
with /
.
Results of GitLab environment info
GitLab Enterprise Edition 12.0.2-ee.
Possible fixes
I think this line is related: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/models/environment.rb#L246
Unfortunately, I'm not experienced with Ruby and the GitLab source code. I would appreciate someone else implementing this fix, hopefully it is quick!
Edited by Glavin Wiechert