On Windows, commands like "Githubinator: Blame" produce URLs containing the full local file path instead of the repo-relative path:
https://github.com/user/repo/blame/<sha>/E%3A%5Cgit%5Cruntime%5Csrc%5Clibraries%5C...
instead of:
https://github.com/user/repo/blame/<sha>/src/libraries/...
Root cause: In src/utils.ts, getRelativeFilePath uses String.replace():
const resolvedFileName = fs.realpathSync(fileName)
return resolvedFileName.replace(repositoryDir.fsPath, "")
fs.realpathSync() resolves to the true filesystem casing (e.g., E:\git\runtime\...), but repositoryDir.fsPath may have different casing (e.g., e:\git\runtime\...). Since String.replace() is case-sensitive, the replacement silently fails on Windows and the entire absolute path ends up in the URL.
Suggested fix: Use path.relative() instead, which handles case and separator differences correctly on all platforms:
const resolvedFileName = fs.realpathSync(fileName)
return path.relative(repositoryDir.fsPath, resolvedFileName)
On Windows, commands like "Githubinator: Blame" produce URLs containing the full local file path instead of the repo-relative path:
instead of:
Root cause: In
src/utils.ts,getRelativeFilePathusesString.replace():fs.realpathSync()resolves to the true filesystem casing (e.g.,E:\git\runtime\...), butrepositoryDir.fsPathmay have different casing (e.g.,e:\git\runtime\...). SinceString.replace()is case-sensitive, the replacement silently fails on Windows and the entire absolute path ends up in the URL.Suggested fix: Use
path.relative()instead, which handles case and separator differences correctly on all platforms: