WIP: form attachments — unit tests, test e-mail with attachment, lint
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
02b1e96d3d
commit
701bb420c1
@@ -137,11 +137,11 @@ export function pdfHasActiveContent(bytes: Uint8Array): boolean {
|
||||
|
||||
export type FileRefusal =
|
||||
/** The name: no extension the field allows, a double extension, a blocked extension. */
|
||||
| 'name'
|
||||
/** The bytes are not what the extension claims. */
|
||||
| 'signature'
|
||||
/** The right container, but with something refused inside (macros, encryption, a program). */
|
||||
| 'content'
|
||||
/** The bytes are not what the extension claims. */
|
||||
| 'name'
|
||||
/** The right container, but with something refused inside (macros, encryption, a program). */
|
||||
| 'signature'
|
||||
|
||||
/**
|
||||
* Name check, before any byte of the file: the last extension must belong to
|
||||
@@ -162,7 +162,7 @@ export function matchFileType(
|
||||
if (extensions.slice(0, -1).some((e) => known.has(e))) {return { refused: 'name' }}
|
||||
for (const key of allowed) {
|
||||
const type = types[key]
|
||||
if (type?.extensions.includes(last)) {return { key, type }}
|
||||
if (type?.extensions.includes(last)) {return { type, key }}
|
||||
}
|
||||
return { refused: 'name' }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user