Skip to content

Commit 69a0fdc

Browse files
committed
Merge pull request #444 from kripod/patch-2
Fixed GitHub link generation on Windows (resolves #318)
2 parents 9f63b61 + 81ff705 commit 69a0fdc

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy