From 49614bb7bd51e91a3ae6f2ed7d4e69067de8c678 Mon Sep 17 00:00:00 2001 From: fyears Date: Thu, 21 Oct 2021 09:46:58 +0800 Subject: [PATCH] fix content type --- main.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.ts b/main.ts index 61fc14f..119f86d 100644 --- a/main.ts +++ b/main.ts @@ -147,13 +147,17 @@ export default class SaveRemotePlugin extends Plugin { fileOrFolder.path ); new Notice(`file ${fileOrFolder.path}`); + const contentType = + mime.contentType( + mime.lookup(`${fileOrFolder.path}`) || undefined + ) || undefined; + console.log(contentType); const results = await s3Client.send( new PutObjectCommand({ Bucket: this.settings.s3BucketName, Key: `${fileOrFolder.path}`, Body: Buffer.from(arrContent), - ContentType: - mime.contentType(`${fileOrFolder.path}`) || undefined, + ContentType: contentType, }) ); }