Matching access token URL with GitLab instance URL is too strict
Summary
The GitLab instance URL configured in gitlab.instanceUrl
and the URL you specify when adding a new access token needs to match perfectly. If one contains slash at the end, the token is not used.
Original description
Connection issues with self-hosted GitLab instance URL name.
e.g. correct connection when https://my.gitlabinstance.io/group-name/project1
as opposed to https://my.gitlabinstance.io/group-name/project1/
There are no instructions that mention to put it exactly like this...
Steps to reproduce
- open workspace with project on
gitlab.com
- remove your token with
GitLab: Remove your Personal Access Token
command - add the same token but specify
https://gitlab.com/
as the instance URL (notice the/
at the end) - now the extension can't authenticate your requests and you see an error
What is the current bug behavior?
The extension cant match the token for https://gitlab.com/
with the configured instance https://gitlab.com
(without the slash)
What is the expected correct behavior?
The extension should be able to recognise that those two URLs are for the same GitLab instance and use the token
Relevant logs and/or screenshots
Possible fixes
A naive solution would be to remove trialling slashes. A more complete solution could be parsing the URLs and deciding what parts need to match (most likely hostname, and port, maybe protocol).