fix(minio): metadata as object not string

A change in the minio JS SDK resulted in uploads being stored
with a defect metadata object in minio, resulting in all
files served as application/octet-stream. This was caused as
the fifth argument to putObject is a metadata object and not
the content-type alone anymore.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2024-06-19 14:28:23 +02:00
parent c970b1cc48
commit c85b11463d
2 changed files with 4 additions and 1 deletions

View file

@ -35,7 +35,9 @@ exports.uploadImage = function (imagePath, callback) {
const key = path.join('uploads', path.basename(imagePath))
const protocol = config.minio.secure ? 'https' : 'http'
minioClient.putObject(config.s3bucket, key, buffer, buffer.size, getImageMimeType(imagePath), function (err, data) {
minioClient.putObject(config.s3bucket, key, buffer, buffer.size, {
'Content-Type': getImageMimeType(imagePath) || 'application/octet-stream'
}, function (err, data) {
if (err) {
callback(new Error(err), null)
return

View file

@ -8,6 +8,7 @@
### Bugfixes
- Fix a crash when having numeric-only values in opengraph frontmatter
- Fix unnecessary session creation on healthcheck endpoint
- Fix defect metadata being sent for minio uploads
## <i class="fa fa-tag"></i> 1.9.9 <i class="fa fa-calendar-o"></i> 2023-07-30