Form files: the visitor is told when the problem is the file — why and what to do; UTF-8 file names
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
b6f9f34705
commit
97202ee03e
@@ -132,6 +132,8 @@ export async function handleFormSubmit(req: PayloadRequest): Promise<Response> {
|
||||
|
||||
const source = Readable.fromWeb(req.body as never)
|
||||
const parser = busboy({
|
||||
// browsers send file names as UTF-8 ("Życiorys.pdf"); the parser's default would read them as Latin-1
|
||||
defParamCharset: 'utf8',
|
||||
headers: { 'content-type': contentType },
|
||||
limits: { fields: 8, fieldSize: VALUES_BYTES, files: options.maxFiles * 4 + 1, fileSize: Math.floor(options.maxSizeMB * MB) + 1 },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user