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

This commit is contained in:
Hoid 2026-02-25 16:04:22 +00:00
parent c4fea7932c
commit 0a002f94ef
6 changed files with 89 additions and 9 deletions

View file

@ -31,10 +31,7 @@ function isPrivateIP(ip: string): boolean {
return false;
}
function sanitizeFilename(name: string): string {
// Strip characters dangerous in Content-Disposition headers
return name.replace(/[\x00-\x1f"\\\r\n]/g, "").trim() || "document.pdf";
}
import { sanitizeFilename } from "../utils/sanitize.js";
export const convertRouter = Router();