Browse Source

Renames sanitizeForFileSystem

main
Eric Amodio 7 years ago
parent
commit
2d9cc030a5
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      src/git/git.ts
  2. +1
    -1
      src/system/string.ts

+ 1
- 1
src/git/git.ts View File

@ -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<string>((resolve, reject) => {
tmp.file({ prefix: `${path.basename(fileName, ext)}-${suffix}__`, postfix: ext },

+ 1
- 1
src/system/string.ts View File

@ -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);
}

Loading…
Cancel
Save