Refuse a non-finite number where a text field coerces one
Mirror / push (push) Successful in 4s
Test / lint (pull_request) Successful in 21s
Test / test (18) (pull_request) Successful in 36s
Test / test (20) (pull_request) Successful in 30s
Test / test (22) (pull_request) Successful in 30s
Test / test (24) (pull_request) Successful in 29s
Test / test (26) (pull_request) Successful in 30s

This commit is contained in:
2026-09-21 10:22:41 +02:00
parent e2edd7e31e
commit e7e71ca9bd
5 changed files with 20 additions and 7 deletions
+4
View File
@@ -99,6 +99,10 @@ function wantText(value: ParamValue): Result<{ text: string }> {
return { err: new Error(`Expected a string or a number, got ${typeof value}`) };
}
if (typeof value === 'number' && !Number.isFinite(value)) {
return { err: new Error(`Expected a finite number, got ${String(value)}`) };
}
const text = String(value);
return pastLatin1(text) ?? { text };