Skip to content

Commit 81ff705

Browse files
committed
Fixed GitHub link generation on Windows (resolves #318)
1 parent 9f63b61 commit 81ff705

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/github.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ function getFileRoot(file) {
1818
module.exports = function (comment) {
1919
var root = getFileRoot(comment.context.file);
2020
var urlPrefix = getGithubURLPrefix(root);
21+
var fileRelativePath = comment.context.file.replace(root + path.sep, '')
22+
.split(path.sep)
23+
.join('/');
24+
2125
if (urlPrefix) {
22-
comment.context.path = comment.context.file.replace(root + '/', '');
26+
comment.context.path = fileRelativePath;
2327
comment.context.github = urlPrefix +
24-
comment.context.file.replace(root + '/', '') +
28+
fileRelativePath +
2529
'#L' + comment.context.loc.start.line + '-' +
2630
'L' + comment.context.loc.end.line;
2731
}

0 commit comments

Comments
 (0)