GitLink icon indicating copy to clipboard operation
GitLink copied to clipboard

Incorrectly encoding branch name in url

Open raggesilver opened this issue 3 months ago • 0 comments

Issue Description

The plugin incorrectly URL-encodes forward slashes in branch names, causing GitLab to fail to resolve the branch reference.

Steps to Reproduce

  1. Check out a branch with a forward slash in its name (e.g., feature/ticket-23)
  2. Open any file in the IDE
  3. 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.

raggesilver avatar Oct 01 '25 17:10 raggesilver