Skip to content

Commit

Permalink
Fixes #607 - encodes branch/ref names in urls
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Jan 4, 2019
1 parent 4d15302 commit 7ea3489
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 14 additions & 4 deletions src/git/remotes/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7ea3489

Please sign in to comment.