Skip to content

Incorrectly encoding branch name in url #361

@raggesilver

Description

@raggesilver

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions