Skip to content

Commit 2b3fbda

Browse files
committed
Update api-link-parser.js
1 parent 5e215df commit 2b3fbda

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

api-link-parser.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ function decodeLink(url) {
2323
const isGithub = url.startsWith('https://github.com/');
2424
if (isGithub) url = url.slice('https://github.com/'.length);
2525

26+
// if link is a Git URL
27+
if (isGithub && url.endsWith('.git')) {
28+
29+
// slice .git ending
30+
url = url.slice(0, -('.git'.length));
31+
32+
}
33+
2634

2735
let baseURL = 'https://codeit.codes';
2836
if (isDev) baseURL = 'https://dev.codeit.codes';
@@ -35,15 +43,6 @@ function decodeLink(url) {
3543
// if link exists
3644
if (link.length > 1) {
3745

38-
// if link is a Git URL
39-
if (isGithub && url.endsWith('.git')) {
40-
41-
// slice .git ending
42-
url = url.slice(0, -('.git'.length));
43-
44-
}
45-
46-
4746
linkData.user = link[0];
4847
linkData.repo = link[1];
4948

0 commit comments

Comments
 (0)