Browse Source

Fixes #607 - encodes branch/ref names in urls

main
Eric Amodio 5 years ago
parent
commit
7ea3489506
2 changed files with 18 additions and 4 deletions
  1. +4
    -0
      CHANGELOG.md
  2. +14
    -4
      src/git/remotes/provider.ts

+ 4
- 0
CHANGELOG.md View File

@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds pinning of comparisons in the _Compare_ view — pinned comparisons will persist across reloads
### Fixed
- Fixes [#607](https://github.com/eamodio/vscode-gitlens/issues/607) - Open file in Remote Doesn't URL encode
## [9.3.0] - 2019-01-02
### Added

+ 14
- 4
src/git/remotes/provider.ts View File

@ -143,17 +143,27 @@ export abstract class RemoteProvider {
url(resource: RemoteResource): string | undefined {
switch (resource.type) {
case RemoteResourceType.Branch:
return this.getUrlForBranch(resource.branch);
return this.getUrlForBranch(encodeURIComponent(resource.branch));
case RemoteResourceType.Branches:
return this.getUrlForBranches();
case RemoteResourceType.Commit:
return this.getUrlForCommit(resource.sha);
return this.getUrlForCommit(encodeURIComponent(resource.sha));
case RemoteResourceType.File:
return this.getUrlForFile(resource.fileName, resource.branch, undefined, resource.range);
return this.getUrlForFile(
resource.fileName,
resource.branch !== undefined ? encodeURIComponent(resource.branch) : undefined,
undefined,
resource.range
);
case RemoteResourceType.Repo:
return this.getUrlForRepository();
case RemoteResourceType.Revision:
return this.getUrlForFile(resource.fileName, resource.branch, resource.sha, resource.range);
return this.getUrlForFile(
resource.fileName,
resource.branch !== undefined ? encodeURIComponent(resource.branch) : undefined,
resource.sha !== undefined ? encodeURIComponent(resource.sha) : undefined,
resource.range
);
}
return undefined;

Loading…
Cancel
Save