mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-15 07:28:05 +00:00
Git - add support for SSH Uri (#152051)
* Add support for SSH Uri * Update extensions/git/src/protocolHandler.ts Co-authored-by: João Moreno <joao.moreno@microsoft.com> Co-authored-by: João Moreno <joao.moreno@microsoft.com>
This commit is contained in:
@@ -38,7 +38,15 @@ export class GitProtocolHandler implements UriHandler {
|
||||
|
||||
let cloneUri: Uri;
|
||||
try {
|
||||
cloneUri = Uri.parse(Array.isArray(data.url) ? data.url[0] : data.url, true);
|
||||
let rawUri = Array.isArray(data.url) ? data.url[0] : data.url;
|
||||
|
||||
// Handle SSH Uri
|
||||
// Ex: git@github.com:microsoft/vscode.git
|
||||
rawUri = rawUri.replace(/^(git@[^\/:]+)(:)/i, 'ssh://$1/');
|
||||
|
||||
cloneUri = Uri.parse(rawUri, true);
|
||||
|
||||
// Validate against supported schemes
|
||||
if (!schemes.has(cloneUri.scheme.toLowerCase())) {
|
||||
throw new Error('Unsupported scheme.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user