refactor: deduplicate sanitizeFilename, add template+sanitize unit tests, fix esc single-quote
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 11m38s
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 11m38s
This commit is contained in:
parent
c4fea7932c
commit
0a002f94ef
6 changed files with 89 additions and 9 deletions
4
src/utils/sanitize.ts
Normal file
4
src/utils/sanitize.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export function sanitizeFilename(name: string, defaultName = "document.pdf"): string {
|
||||
const sanitized = String(name || "").replace(/[\x00-\x1f"'\\\r\n]/g, "_").trim().substring(0, 200);
|
||||
return sanitized || defaultName;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue