From c85b11463dd4e15c8d88493aecfc5a173c1a7913 Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Wed, 19 Jun 2024 14:28:23 +0200 Subject: [PATCH] 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 --- lib/web/imageRouter/minio.js | 4 +++- public/docs/release-notes.md | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/web/imageRouter/minio.js b/lib/web/imageRouter/minio.js index 3ced94e2d..412f67295 100644 --- a/lib/web/imageRouter/minio.js +++ b/lib/web/imageRouter/minio.js @@ -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 diff --git a/public/docs/release-notes.md b/public/docs/release-notes.md index 8a9780843..24d8e0c95 100644 --- a/public/docs/release-notes.md +++ b/public/docs/release-notes.md @@ -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 ## 1.9.9 2023-07-30