From b08e46fd6f736af3c4d77627d84a163358bca88c Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sun, 20 Jan 2019 15:46:37 -0500 Subject: [PATCH] Fixes #591 & #633 - encodes uris properly now --- CHANGELOG.md | 2 ++ src/git/gitUri.ts | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d8bec8..1533708 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed +- Fixes [#591](https://github.com/eamodio/vscode-gitlens/issues/591) - GitLens Error: Unable to open - Fixes [#620](https://github.com/eamodio/vscode-gitlens/issues/620) - Branch names with only digits always appear first — thanks to [PR #621](https://github.com/eamodio/vscode-gitlens/pull/621) by Yan Zhang ([@Eskibear](https://github.com/Eskibear)) - Fixes [#626](https://github.com/eamodio/vscode-gitlens/issues/626) - Branch names with only digits always appear first — thanks to [PR #627](https://github.com/eamodio/vscode-gitlens/pull/627) by Marc Lasson ([@mlasson](https://github.com/mlasson)) - Fixes [#631](https://github.com/eamodio/vscode-gitlens/issues/631) - Remotes fail to show in gui +- Fixes [#633](https://github.com/eamodio/vscode-gitlens/issues/633) - Compare File with Previous Revision doesn't work if path contains '#' ## [9.4.1] - 2019-01-08 diff --git a/src/git/gitUri.ts b/src/git/gitUri.ts index 45c788a..d8ba500 100644 --- a/src/git/gitUri.ts +++ b/src/git/gitUri.ts @@ -326,11 +326,13 @@ export class GitUri extends ((Uri as any) as UriEx) { static git(fileName: string, repoPath?: string) { const path = GitUri.resolve(fileName, repoPath); return Uri.parse( - `git:${path}?${JSON.stringify({ - // Ensure we use the fsPath here, otherwise the url won't open properly - path: Uri.file(path).fsPath, - ref: '~' - })}` + `git:${encodeURIComponent(path)}?${encodeURIComponent( + JSON.stringify({ + // Ensure we use the fsPath here, otherwise the url won't open properly + path: Uri.file(path).fsPath, + ref: '~' + }) + )}` ); } @@ -398,9 +400,9 @@ export class GitUri extends ((Uri as any) as UriEx) { }; const uri = Uri.parse( - `${DocumentSchemes.GitLens}:///${repoName}@${shortSha}${ - filePath === slash ? empty : filePath - }?${JSON.stringify(data)}` + `${DocumentSchemes.GitLens}:///${encodeURIComponent(repoName)}@${shortSha}${ + filePath === slash ? empty : encodeURIComponent(filePath) + }?${encodeURIComponent(JSON.stringify(data))}` ); return uri; }