refactor: mark dead exports with TODO, deduplicate field sanitization, fix import placement

This commit is contained in:
openhands
2026-07-20 14:47:05 +02:00
parent 2beba07ba5
commit d5e3bc7875
13 changed files with 49 additions and 64 deletions
+11
View File
@@ -182,6 +182,15 @@ export function canonicalize(input: string): string {
return input.normalize("NFC").trim();
}
/** Normalize, trim and truncate a form field value to maxLen (default 255). */
export function sanitizeField(
value: FormDataEntryValue | null,
maxLen = 255,
): string {
const s = canonicalize(String(value ?? ""));
return s.slice(0, maxLen);
}
const INVALID_FILENAME_CHARS = /[<>:"/\\|?*]/;
function removeControlChars(s: string): string {
@@ -193,6 +202,7 @@ function removeControlChars(s: string): string {
return result;
}
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
export function sanitizeFilename(name: string): string {
return removeControlChars(
name
@@ -212,6 +222,7 @@ export function canonicalizeFormValue(
return maxLen ? s.slice(0, maxLen) : s;
}
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
export function canonicalizeFormData(
formData: FormData,
fields: Record<string, number | undefined>,