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 21bf12a21c
commit 913eb96ab0
1 changed files with 6 additions and 0 deletions

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()