Skip to content

Open active file on GitLab does not resolve from git repository root

Summary

When opening a subfolder of a git repository in VS Code Open active file on GitLab resolves to the wrong path on GitLab.

Steps to reproduce

What is the current bug behavior?

The GitLab page opens up and reads: "helloWorld.txt" did not exist on "main" Screenshot_2021-02-25_at_17.19.42

The URL tried to open reads: https://gitlab.com/hffmnn/open-active-file-issue/-/tree/main#L1

What is the expected correct behavior?

The file should be opened on GitLab with the selected line highlighted.

Possible fixes

I guess this line of code returns the wrong path: https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/blob/main/src/openers.js#L46. Instead of returning sth. like app/helloWorld.txt it only returns helloWorld.txt.