@samitouri / QOS-React-2 / commits / 395c02567c

Handle HTTPS Git clone URLs

Brian Vaughn committed May 23, 2019 at 11:55 UTC 395c02567cfe0e70ab85f4fc134a4d8643123f6e
1 file changed +12 -6
shells/utils.js
+12 -6
@@ -9,13 +9,19 @@ function getGitCommit() {
9 }
10
11 function getGitHubURL() {
12 - // TODO potentially replac this with an fb.me URL (if it can forward the query params)
13 - return execSync('git remote get-url origin')
12 + // TODO potentially replace this with an fb.me URL (assuming it can forward the query params)
13 + const url = execSync('git remote get-url origin')
14 .toString()
15 - .trim()
16 - .replace(':', '/')
17 - .replace('git@', 'https://')
18 - .replace('.git', '');
15 + .trim();
16 +
17 + if (url.startsWith('https://')) {
18 + return url.replace('.git', '');
19 + } else {
20 + return url
21 + .replace(':', '/')
22 + .replace('git@', 'https://')
23 + .replace('.git', '');
24 + }
25 }
26
27 function getVersionString() {