fix: view repository button using ssh:// protocol (#1118)

This commit is contained in:
Mauro 2021-06-23 06:19:58 -03:00 committed by GitHub
parent 0b2125ffbd
commit db4f370863
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,8 +78,8 @@ export async function activity(previous: ActivityPayload = {}) {
let repo = git.repositories.find((repo) => repo.ui.selected)?.state.remotes[0]?.fetchUrl; let repo = git.repositories.find((repo) => repo.ui.selected)?.state.remotes[0]?.fetchUrl;
if (repo) { if (repo) {
if (repo.startsWith('git@')) { if (repo.startsWith('git@') || repo.startsWith('ssh://')) {
repo = repo.replace(':', '/').replace('git@', 'https://').replace('.git', ''); repo = repo.replace('ssh://', '').replace(':', '/').replace('git@', 'https://').replace('.git', '');
} else { } else {
repo = repo.replace(/(https:\/\/)([^@]*)@(.*?$)/, '$1$3').replace('.git', ''); repo = repo.replace(/(https:\/\/)([^@]*)@(.*?$)/, '$1$3').replace('.git', '');
} }