vscode-open-in-github icon indicating copy to clipboard operation
vscode-open-in-github copied to clipboard

Link to subgroups on gitlab.com gives 404

Open jonaskello opened this issue 4 years ago • 1 comments

In gitlab you can have a subgroup which makes the URL longer.

For example lets say we have groupa and under it a subgroup groupb. So it becomes groupa/groupb. Then the URL for a file in the repo/project project1 that lives in groupb would become something like this:

https://gitlab.com/groupa/groupb/project1/blob/xxxxx/path/to/source/file#L123

However the plugin adds an extra /git in front of the url so it becomes:

https://gitlab.com/git/groupa/groupb/project1/blob/xxxxx/path/to/source/file#L123

This results in a 404. Removing the /git prefix gives the correct page.

jonaskello avatar Dec 21 '21 11:12 jonaskello

I'm getting this as well. I thought it might be a problem with the version of git-url-parse package that's being used. I wrote a test script and tried it with v11.1.1 (and a few other versions) of git-url-parse, but it never produced a url with /git

const gitUrlParse = require('git-url-parse');

const remote = '[email protected]:dev/group/project.git';
const gitUrl = gitUrlParse(remote);
const url = gitUrl.toString('https').replace(/(\.git)$/, '');
console.log('url:', url);

This produces https://gitlab.myorg.com/dev/group/project without the extra /git.

So maybe it has to do with the remote url that's getting passed into get-url-parse?

tortis avatar May 17 '22 21:05 tortis