1
0
Fork 0
mirror of synced 2024-06-12 15:34:54 +12:00

Fixing an issue which was alerting, x-amz-meta-fieldname contains an invalid value, this error isn't really documented, but comes from if a metadata tag is sent up with nullish, or a non-string type. Fixing this in the core library, removing an invalid inputs.

This commit is contained in:
mike12345567 2022-11-08 11:34:16 +00:00
parent eab156729d
commit 862525cc0e

View file

@ -163,6 +163,12 @@ export const upload = async ({
ContentType: type || CONTENT_TYPE_MAP[extension.toLowerCase()],
}
if (metadata) {
// remove any nullish keys from the metadata object, as these may be considered invalid
for (let key of Object.keys(metadata)) {
if (!metadata[key] || typeof metadata[key] !== "string") {
delete metadata[key]
}
}
config.Metadata = metadata
}
return objectStore.upload(config).promise()