Git - escape shell-sensitive characters (#236849)
parent
2e5cbd49c8
commit
fca210cd10
|
@ -348,10 +348,15 @@ function getGitErrorCode(stderr: string): string | undefined {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/microsoft/vscode/issues/89373
|
|
||||||
// https://github.com/git-for-windows/git/issues/2478
|
|
||||||
function sanitizePath(path: string): string {
|
function sanitizePath(path: string): string {
|
||||||
return path.replace(/^([a-z]):\\/i, (_, letter) => `${letter.toUpperCase()}:\\`);
|
return path
|
||||||
|
// Drive letter
|
||||||
|
// https://github.com/microsoft/vscode/issues/89373
|
||||||
|
// https://github.com/git-for-windows/git/issues/2478
|
||||||
|
.replace(/^([a-z]):\\/i, (_, letter) => `${letter.toUpperCase()}:\\`)
|
||||||
|
// Shell-sensitive characters
|
||||||
|
// https://github.com/microsoft/vscode/issues/133566
|
||||||
|
.replace(/(["'\\\$!><#()\[\]*&^| ;{}?`])/g, '\\$1');
|
||||||
}
|
}
|
||||||
|
|
||||||
const COMMIT_FORMAT = '%H%n%aN%n%aE%n%at%n%ct%n%P%n%D%n%B';
|
const COMMIT_FORMAT = '%H%n%aN%n%aE%n%at%n%ct%n%P%n%D%n%B';
|
||||||
|
|
Loading…
Reference in New Issue