Skip to content

Apply encodeURIComponent() to pieces of the custom remote URL #2336

@amir-f

Description

@amir-f

Description

We have set a custom remote by specifying the following dictionary in the .vscode/settings.json file

"gitlens.remotes": [
    {
      "domain": "git.foo.com",
      "type": "Custom",
      "name": "Foo",
      "protocol": "https",
      "urls": {
        "repository": "https://foo.com/${repo}",
        "branches": "https://foo.com/${repo}/branches/master/",
        "branch": "https://foo.com/${repo}/browse/${branch}/",
        ...
      }
    }
  ],

However the branch name ${branch} can itself have the / in it and this would make the URL invalid. What is the best way to apply encodeURIComponent() to the branch name? That is:

https://foo.com/${repo}/browse/encodeURIComponent(${branch})/

GitLens Version

13.0.4

VS Code Version

Version: 1.73.1 (Universal)
Commit: 6261075646f055b99068d3688932416f2346dd3b
Date: 2022-11-09T02:08:38.961Z (22 hrs ago)
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 21.6.0

Git Version

git version 2.37.0 (Apple Git-136)

Logs, Screenshots, Screen Captures, etc

No response

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions