From 10674124c89c6912109d862e9acc027431291273 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Fri, 9 Jun 2017 17:26:20 -0400 Subject: [PATCH] Fixes #87 - Can't open files in remote when using git@ urls (ssh) --- src/git/remotes/factory.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/git/remotes/factory.ts b/src/git/remotes/factory.ts index 5b17253..b158010 100644 --- a/src/git/remotes/factory.ts +++ b/src/git/remotes/factory.ts @@ -15,7 +15,7 @@ const providerMap = new Map RemoteProv ['visualstudio.com', (domain: string, path: string) => new VisualStudioService(domain, path)] ]); -const UrlRegex = /^(?:git:\/\/(.*?)\/|https:\/\/(.*?)\/|http:\/\/(.*?)\/|git@(.*):\/\/|ssh:\/\/git@(.*?)\/)(.*)$/; +const UrlRegex = /^(?:git:\/\/(.*?)\/|https:\/\/(.*?)\/|http:\/\/(.*?)\/|git@(.*):|ssh:\/\/(?:.*@)?(.*?)(?::.*?)?\/)(.*)$/; export class RemoteProviderFactory { @@ -25,7 +25,7 @@ export class RemoteProviderFactory { if (match == null) return undefined; const domain = match[1] || match[2] || match[3] || match[4] || match[5]; - const path = match[6].replace(/\.git/, ''); + const path = match[6].replace(/\.git\/?$/, ''); const key = domain.toLowerCase().endsWith('visualstudio.com') ? 'visualstudio.com'