From 9b90b30cfbac392550c9939d6fc34a693ca1bbb8 Mon Sep 17 00:00:00 2001 From: Travis Collins Date: Sun, 3 Jan 2021 12:16:14 -0700 Subject: [PATCH] Fixes #1303: Fix remote URLs for Azure DevOps --- src/git/remotes/azure-devops.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/git/remotes/azure-devops.ts b/src/git/remotes/azure-devops.ts index d0dc152..f6d40e5 100644 --- a/src/git/remotes/azure-devops.ts +++ b/src/git/remotes/azure-devops.ts @@ -35,6 +35,10 @@ export class AzureDevOpsRemote extends RemoteProvider { } } + // Azure DevOps allows projects and repository names with spaces. In that situation, + // the `path` will be previously encoded during git clone + // revert that encoding to avoid double-encoding by gitlens during copy remote and open remote + path = decodeURIComponent(path); super(domain, path, protocol, name); } @@ -131,8 +135,8 @@ export class AzureDevOpsRemote extends RemoteProvider { line = ''; } - if (sha) return `${this.baseUrl}/commit/${sha}/?_a=contents&path=%2F${fileName}${line}`; - if (branch) return `${this.baseUrl}/?path=%2F${fileName}&version=GB${branch}&_a=contents${line}`; - return `${this.baseUrl}?path=%2F${fileName}${line}`; + if (sha) return `${this.baseUrl}/commit/${sha}/?_a=contents&path=/${fileName}${line}`; + if (branch) return `${this.baseUrl}/?path=/${fileName}&version=GB${branch}&_a=contents${line}`; + return `${this.baseUrl}?path=/${fileName}${line}`; } }