Wiki links broken on self-hosted Gitlab (Path to relative URL is doubled)

Summary

The /gitlab path to Gitlab is rendered as /gitlab/gitlab in Markdown links.

Steps to reproduce

# gitlab.rb
external_url "https://DOMAIN/gitlab"

The wiki page https://DOMAIN/gitlab/mygroup/myproj/-/wikis/some_page:

[MyLinkText](my-link-slug)

What is the current bug behavior?

On page some_page, the link MyLinkText links to https://DOMAIN/gitlab/gitlab/mygroup/myproj/-/wikis/my-link-slug

What is the expected correct behavior?

On page some_page, the link MyLinkText should link to https://DOMAIN/gitlab/mygroup/myproj/-/wikis/my-link-slug

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`)

root@mfix:/etc/gitlab# gitlab-rake gitlab:env:info

System information
System:
Current User:	git
Using RVM:	no
Ruby Version:	2.6.6p146
Gem Version:	2.7.10
Bundler Version:1.17.3
Rake Version:	12.3.3
Redis Version:	5.0.9
Git Version:	2.26.2
Sidekiq Version:5.2.7
Go Version:	unknown

GitLab information
Version:	13.0.6
Revision:	5aa982e01ea
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	11.7
URL:		https://mfix.netl.doe.gov/gitlab
HTTP Clone URL:	https://mfix.netl.doe.gov/gitlab/some-group/some-project.git
SSH Clone URL:	git@mfix.netl.doe.gov:some-group/some-project.git
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers:

GitLab Shell
Version:	13.2.0
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git

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) root@mfix:/etc/gitlab# gitlab-rake gitlab:check SANITIZE=true Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 13.2.0 ? ... OK (13.2.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

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

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

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: ... 4/7 ... yes 12/8 ... yes 22/11 ... yes 26/12 ... yes 22/13 ... yes 25/16 ... yes 26/18 ... yes 25/20 ... yes 14/21 ... yes 33/24 ... yes 32/27 ... yes 11/28 ... yes 25/29 ... yes 10/30 ... yes 37/32 ... yes 12/33 ... yes 33/34 ... yes 22/35 ... yes 18/37 ... yes 6/38 ... yes 25/39 ... yes 25/41 ... yes 33/42 ... yes 33/44 ... yes 26/45 ... yes 4/46 ... yes 36/47 ... yes 33/48 ... yes 22/49 ... yes 33/50 ... yes 4/52 ... yes 33/54 ... yes 25/56 ... yes 53/57 ... yes 54/58 ... yes 25/59 ... yes 6/60 ... yes 47/61 ... yes 25/62 ... yes 26/64 ... yes 4/65 ... yes 4/67 ... yes 10/68 ... yes 41/71 ... yes 74/73 ... yes 73/74 ... yes 4/76 ... yes 73/77 ... yes 71/81 ... yes 71/83 ... yes 4/84 ... yes 73/85 ... yes 22/86 ... yes 73/87 ... yes 90/89 ... yes 73/94 ... yes 73/95 ... yes 74/96 ... yes 74/97 ... yes 73/98 ... yes 97/99 ... yes 98/100 ... yes 90/101 ... yes 86/102 ... yes 74/103 ... yes 97/105 ... yes 73/107 ... yes 92/108 ... yes 102/109 ... yes 4/110 ... yes 26/113 ... yes 97/114 ... yes 9/116 ... yes 99/117 ... yes 90/118 ... yes 102/119 ... yes 8/123 ... yes 22/124 ... yes 97/125 ... yes 22/126 ... yes 22/127 ... yes 73/128 ... yes 97/130 ... yes 90/131 ... yes 102/133 ... yes 25/135 ... yes 62/136 ... yes 26/140 ... yes 118/141 ... yes 102/142 ... yes 25/143 ... yes 94/145 ... yes 4/146 ... yes 131/147 ... yes 131/148 ... yes 90/149 ... yes 90/150 ... yes 73/151 ... yes 71/152 ... yes 5/153 ... yes 74/154 ... yes 5/155 ... yes 103/156 ... yes 4/157 ... yes 103/158 ... yes 97/159 ... yes 97/160 ... yes 9/161 ... yes 103/162 ... yes 131/163 ... yes 130/164 ... yes 130/165 ... yes 102/166 ... yes 102/167 ... yes 22/169 ... yes 97/170 ... yes 4/171 ... yes 22/172 ... yes 128/173 ... yes 156/174 ... yes 157/177 ... yes 103/179 ... yes 160/180 ... yes 25/181 ... yes 158/182 ... yes 90/183 ... yes 160/184 ... yes 10/185 ... yes 5/186 ... yes 165/187 ... yes 4/188 ... yes 74/189 ... yes 169/191 ... yes 103/192 ... yes 170/193 ... yes 103/194 ... yes 74/195 ... yes 5/196 ... yes 10/197 ... yes 103/198 ... yes 34/199 ... yes 34/200 ... yes 34/201 ... yes 10/202 ... yes 10/203 ... yes 9/204 ... yes 4/205 ... yes 103/206 ... yes 10/207 ... yes 181/210 ... yes 78/211 ... yes 10/212 ... yes 103/213 ... yes 5/216 ... yes 5/218 ... yes 3/219 ... yes 103/220 ... yes 10/221 ... yes 105/222 ... yes 72/223 ... yes 10/224 ... yes 177/225 ... yes 131/226 ... yes 8/227 ... yes 103/228 ... yes 102/230 ... yes 102/231 ... yes 102/232 ... yes 194/234 ... yes 194/235 ... yes 188/236 ... yes 4/237 ... yes 5/238 ... yes 167/239 ... yes 109/240 ... yes 111/243 ... yes 127/244 ... yes 196/245 ... yes 194/246 ... yes 79/247 ... yes 90/248 ... yes 199/249 ... yes 90/250 ... yes 188/251 ... yes 10/252 ... yes 10/253 ... yes 162/254 ... yes 206/255 ... yes 5/258 ... yes Redis version >= 4.0.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.6) Git version >= 2.22.0 ? ... yes (2.26.2) Git user has default SSH configuration? ... yes Active users: ... 170 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished