From 5bac4b5d9099d2bfb19b29d9bb5d8e89937ebf7c Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 15 Nov 2021 23:37:59 -0500 Subject: [PATCH] Fixes #1669, #1695: avoid double encoding on space --- CHANGELOG.md | 2 ++ src/git/remotes/provider.ts | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 157a672..d2dbff0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed +- Fixes [#1669](https://github.com/Axosoft/vscode-gitlens/issues/1669) - Workitem Link (Hover ) for Repository (DevOps) with Blank is broken +- Fixes [#1695](https://github.com/Axosoft/vscode-gitlens/issues/1695) - gitlens.remotes: ${repo} has '%2520' instead of '%20' for a space - Fixes [#1531](https://github.com/eamodio/vscode-gitlens/issues/1531) - Typo in `gitlens.defaultGravatarsStyle` options — thanks to [PR #1532](https://github.com/eamodio/vscode-gitlens/pull/1532) by Alwin Wang ([@alwinw](https://github.com/alwinw)) - Fixes [#1511](https://github.com/eamodio/vscode-gitlens/issues/1511) - Avatars are blurry on retina displays — thanks to [PR #1595](https://github.com/eamodio/vscode-gitlens/pull/1595) by Adaex Yang ([@adaex](https://github.com/adaex)) - Fixes [#1609](https://github.com/eamodio/vscode-gitlens/issues/1609) - X.globalState.setKeysForSync is not a function — thanks to [PR #1610](https://github.com/eamodio/vscode-gitlens/pull/1610) by Stanislav Lvovsky ([@slavik-lvovsky](https://github.com/slavik-lvovsky)) diff --git a/src/git/remotes/provider.ts b/src/git/remotes/provider.ts index 22516b2..63cb488 100644 --- a/src/git/remotes/provider.ts +++ b/src/git/remotes/provider.ts @@ -234,7 +234,11 @@ export abstract class RemoteProvider implements RemoteProviderReference { protected encodeUrl(url: string): string; protected encodeUrl(url: string | undefined): string | undefined; protected encodeUrl(url: string | undefined): string | undefined { - return url != null ? encodeURI(url).replace(/#/g, '%23') : undefined; + if (url == null) return undefined; + + // Not a fan of this, but it's hard to gauge previous encoding and this is the most common case + url = url.replace(/%20/g, ' '); + return encodeURI(url).replace(/#/g, '%23'); } }