Fix MIME type detection from HTTP form requests

Signed-off-by: Joe Ma <rikkaneko23@gmail.com>
This commit is contained in:
Joe Ma 2022-06-03 02:16:48 +08:00
parent 1ec2a9f7f0
commit d79281a6c6
No known key found for this signature in database
GPG key ID: 7A0ECF5F5EDC587F

View file

@ -120,9 +120,11 @@ export default {
}
// File
if (data instanceof File) {
title = data.name ?? undefined;
if (data.name) {
title = data.name;
mime = contentType(title) || undefined;
}
buffer = await data.arrayBuffer();
mime = data.type;
// Text
} else {
buffer = new TextEncoder().encode(data)