GitLink
GitLink copied to clipboard
Incorrectly encoding branch name in url
Issue Description
The plugin incorrectly URL-encodes forward slashes in branch names, causing GitLab to fail to resolve the branch reference.
Steps to Reproduce
- Check out a branch with a forward slash in its name (e.g.,
feature/ticket-23) - Open any file in the IDE
- Generate a GitLink for a specific line
Current Behavior
The generated URL encodes the forward slash as %2F:
https://gitlab.com/<org>/<project>/blob/feature%2Fticket-23/path/to/file.py#L236-236
GitLab returns a 404 error because it cannot resolve the branch name with the encoded slash.
Expected Behavior
The forward slash in the branch name should remain unencoded:
https://gitlab.com/<org>/<project>/blob/feature/ticket-23/path/to/file.py#L236-236
Additional Context
This issue affects any branch that follows common naming conventions like feature/, bugfix/, hotfix/, etc. GitLab's URL structure requires forward slashes in branch names to remain unencoded in the path segment of the URL.
Not sure how it works on GitHub or other platforms.