Skip to content

Commit 7a68b4b

Browse files
hua03bugthesystem
authored andcommitted
fixed Github invalid link (#79)
* fixed Github invalid link * Escape the spaces in the path
1 parent 5485cdb commit 7a68b4b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/extension.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ function getGitProviderLink(cb, fileFsPath, lines, pr) {
6363
return;
6464
}
6565

66-
let subdir = repoDir !== fileFsPath ? '/' + path.relative(repoDir, fileFsPath) : '';
66+
let formattedFilePath = path.relative(repoDir, fileFsPath).replace(/\\/g, '/');
67+
formattedFilePath = formattedFilePath.replace(/\s{1}/g, '%20');
68+
69+
let subdir = repoDir !== fileFsPath ? '/' + formattedFilePath : '';
6770

6871
if (pr) {
6972
try {

0 commit comments

Comments
 (0)