(name: string)
| 28 | } |
| 29 | |
| 30 | function safeFilename(name: string): string { |
| 31 | return path |
| 32 | .basename(name) |
| 33 | .replace(/["\\]/g, '_') |
| 34 | .replace(/[\r\n\t]/g, '') |
| 35 | } |
| 36 | |
| 37 | function deduplicatedFilename(preferred: string, existing: Set<string>, imageId: string): string { |
| 38 | if (!existing.has(preferred)) return preferred |