Skip to content

Commit

Permalink
Fixes gitkraken#1045 - Correctly resolve mapped drive on Windows
Browse files Browse the repository at this point in the history
Use fs.realpath to get a path starting with the drive letter for mapped drives.
The previously used fs.realpath.native function returned UNC paths on Windows,
even if the path is actually using a drive letter
  • Loading branch information
egfx-notifications committed Dec 18, 2020
1 parent da44f99 commit c36af0a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/git/gitService.ts
Expand Up @@ -3051,17 +3051,12 @@ export class GitService implements Disposable {

try {
const networkPath = await new Promise<string | undefined>(resolve =>
fs.realpath.native(`${letter}:`, { encoding: 'utf8' }, (err, resolvedPath) =>
fs.realpath(`${letter}:`, { encoding: 'utf8' }, (err, resolvedPath) =>
resolve(err != null ? undefined : resolvedPath),
),
);
if (networkPath != null) {
return Strings.normalizePath(
repoUri.fsPath.replace(
networkPath,
`${letter.toLowerCase()}:${networkPath.endsWith('\\') ? '\\' : ''}`,
),
);
return networkPath;
}
} catch {}
}
Expand Down

0 comments on commit c36af0a

Please sign in to comment.