Skip to content

Commit 9640830

Browse files
author
Eric Amodio
committed
Fixes microsoft#94882 -- checks for trailing \ & protects
if somehow `networkPath` had a trailing \, it would cause this behavior
1 parent 0e5a5fb commit 9640830

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

extensions/git/src/git.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,15 +435,19 @@ export class Git {
435435
const [, letter] = match;
436436

437437
try {
438-
const networkPath = await new Promise<string>(resolve =>
438+
let networkPath = await new Promise<string>(resolve =>
439439
realpath.native(`${letter}:`, { encoding: 'utf8' }, (err, resolvedPath) =>
440440
// eslint-disable-next-line eqeqeq
441441
resolve(err != null ? undefined : resolvedPath),
442442
),
443443
);
444444
if (networkPath !== undefined) {
445+
networkPath = `${networkPath}\\`;
445446
return path.normalize(
446-
repoUri.fsPath.replace(networkPath, `${letter.toLowerCase()}:`),
447+
repoUri.fsPath.replace(
448+
networkPath,
449+
`${letter.toLowerCase()}:${networkPath.endsWith('\\') ? '\\' : ''}`
450+
),
447451
);
448452
}
449453
} catch { }

0 commit comments

Comments
 (0)