refactor: mark dead exports with TODO, deduplicate field sanitization, fix import placement
Local Build and Deploy / deploy (push) Successful in 1m36s

This commit is contained in:
openhands committed 2026-07-20 14:47:05 +02:00
1 parent 2beba07ba5
commit d5e3bc7875
13 files changed
+49 -64

No files matched your search

+1
View File
@@ -49,6 +49,7 @@ export class RateLimitError extends DomainError {
}
}
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
export class ConflictError extends DomainError {
constructor(message: string) {
super(message, 409);
+3
View File
@@ -30,6 +30,7 @@ export function runWithStore<T>(store: RequestStore, fn: () => T): T {
return als.run(store, fn);
}
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
export function getRequestStore(): RequestStore | null {
return als.getStore() ?? null;
}
@@ -38,6 +39,7 @@ export function getRequestId(): RequestId {
return als.getStore()?.requestId ?? generateRequestId();
}
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
export function getClientIp(): IpAddress {
return als.getStore()?.ip ?? ("0.0.0.0" as IpAddress);
}
@@ -47,6 +49,7 @@ export function setContextUserId(userId: UserId): void {
if (store) store.userId = userId;
}
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
export function elapsed(): number {
const store = als.getStore();
return store ? Date.now() - store.startedAt : 0;
+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>,