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

Can’t open links from GitLab if they contain a dash

Open herrherrmann opened this issue 2 years ago • 3 comments

Heya, thanks for this extension!

I’m trying to open some files on GitLab and it doesn’t fully work. Here’s an example:

  • Repo URL: https://gitlab.com/klima-pods/SwiftWebVC
  • Example file link/URL: https://gitlab.com/klima-pods/SwiftWebVC/-/blob/master/README.md

If I try to open that file with the extension, I’m getting this error in VS Code:

Path does not exist The path '~/dev/-/README.md:0:1' does not exist on this computer.

My base path is defined as '/Users/sebastian/dev' (I also tried with a trailing slash: '/Users/sebastian/dev/'). The problem seems to be that the repo name isn’t picked up and a dash is used instead (~/dev/- instead of ~/dev/SwiftWebVC).

herrherrmann avatar Jul 20 '22 08:07 herrherrmann

Hey! I haven't used Gitlab (or the extension) in a while and it looks like Gitlab has changed their URLs - that dash in the URL didn't use to be there.

You can find the code that builds the URL here: https://github.com/aberonni/open-in-vscode/blob/master/src/contextmenu.js#L101-L126

Feel free to submit a PR that addresses the change and I'll be happy to take a look at it.

aberonni avatar Jul 20 '22 09:07 aberonni

Heya, thanks for this extension!

I’m trying to open some files on GitLab and it doesn’t fully work. Here’s an example:

  • Repo URL: https://gitlab.com/klima-pods/SwiftWebVC
  • Example file link/URL: https://gitlab.com/klima-pods/SwiftWebVC/-/blob/master/README.md

If I try to open that file with the extension, I’m getting this error in VS Code:

Path does not exist The path '~/dev/-/README.md:0:1' does not exist on this computer.

My base path is defined as '/Users/sebastian/dev' (I also tried with a trailing slash: '/Users/sebastian/dev/'). The problem seems to be that the repo name isn’t picked up and a dash is used instead (~/dev/- instead of ~/dev/SwiftWebVC).

I have the same problem,(~/dev/- instead of ~/dev/myProject)

xiangdongbu avatar Mar 28 '23 09:03 xiangdongbu

Thanks for the extra report. As mentioned above, I might not be able to look at this anytime soon. Feel free to submit a PR if you can figure out what is wrong with the code above.

aberonni avatar Mar 28 '23 10:03 aberonni