diff --git a/lib/github.js b/lib/github.js index 8d5f0ebe7..5dc19bc2b 100644 --- a/lib/github.js +++ b/lib/github.js @@ -18,10 +18,14 @@ function getFileRoot(file) { module.exports = function (comment) { var root = getFileRoot(comment.context.file); var urlPrefix = getGithubURLPrefix(root); + var fileRelativePath = comment.context.file.replace(root + path.sep, '') + .split(path.sep) + .join('/'); + if (urlPrefix) { - comment.context.path = comment.context.file.replace(root + '/', ''); + comment.context.path = fileRelativePath; comment.context.github = urlPrefix + - comment.context.file.replace(root + '/', '') + + fileRelativePath + '#L' + comment.context.loc.start.line + '-' + 'L' + comment.context.loc.end.line; }