diff --git a/src/git/git.ts b/src/git/git.ts index 94360dc..2bde546 100644 --- a/src/git/git.ts +++ b/src/git/git.ts @@ -134,7 +134,7 @@ export class Git { const data = await Git.show(repoPath, fileName, branchOrSha, { encoding: 'binary' }); if (data === undefined) return undefined; - const suffix = Strings.truncate(Strings.sanitizeForFS(Git.isSha(branchOrSha) ? Git.shortenSha(branchOrSha) : branchOrSha), 50, ''); + const suffix = Strings.truncate(Strings.sanitizeForFileSystem(Git.isSha(branchOrSha) ? Git.shortenSha(branchOrSha) : branchOrSha), 50, ''); const ext = path.extname(fileName); return new Promise((resolve, reject) => { tmp.file({ prefix: `${path.basename(fileName, ext)}-${suffix}__`, postfix: ext }, diff --git a/src/system/string.ts b/src/system/string.ts index 015f51b..ef05b47 100644 --- a/src/system/string.ts +++ b/src/system/string.ts @@ -99,7 +99,7 @@ export namespace Strings { // Removes \ / : * ? " < > | and C0 and C1 control codes const illegalCharsForFSRegEx = /[\\/:*?"<>|\x00-\x1f\x80-\x9f]/g; - export function sanitizeForFS(s: string, replacement: string = '_') { + export function sanitizeForFileSystem(s: string, replacement: string = '_') { if (!s) return s; return s.replace(illegalCharsForFSRegEx, replacement); }