From ca72073de37415142fa46fd68c783b3ea5ed22d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Varela?= Date: Fri, 24 Sep 2021 19:06:29 +0100 Subject: [PATCH] Fix azure storage content-type (#8294) * fix azure storage content-type * Use ?? instead of || Co-authored-by: rijkvanzanten --- packages/drive-azure/src/AzureBlobWebServices.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/drive-azure/src/AzureBlobWebServices.ts b/packages/drive-azure/src/AzureBlobWebServices.ts index 3afbb0a26d..c7b4cba0a6 100644 --- a/packages/drive-azure/src/AzureBlobWebServices.ts +++ b/packages/drive-azure/src/AzureBlobWebServices.ts @@ -213,14 +213,20 @@ export class AzureBlobWebServicesStorage extends Storage { return { raw: result }; } - public async put(location: string, content: Buffer | NodeJS.ReadableStream | string): Promise { + public async put( + location: string, + content: Buffer | NodeJS.ReadableStream | string, + type?: string + ): Promise { location = this._fullPath(location); const blockBlobClient = this.$containerClient.getBlockBlobClient(location); try { if (isReadableStream(content)) { - const result = await blockBlobClient.uploadStream(content as Readable); + const result = await blockBlobClient.uploadStream(content as Readable, undefined, undefined, { + blobHTTPHeaders: { blobContentType: type ?? 'application/octet-stream' }, + }); return { raw: result }; }