From 3dd8b753cb7ed06c318faba56eaa86bcf98c498b Mon Sep 17 00:00:00 2001 From: Weibing Zhan Date: Tue, 1 Aug 2023 16:27:57 -0700 Subject: [PATCH] Copy over the ContentType of source blob for storage-encrypted blobs that are not handled by the packager Description Some blobs in input assets are directly copied over to destination folder, such as .json file, thumbnail file etc. When they are not encrypted with customer's key, the code can transfer the headers from source blob to destination, When they are encrypted with customer's key, this new change ensures the ContentType header is transfered to the destionation folder, so that ContentType property is always available for all blobs in the destination folder. --- azure/AzureStorageUploader.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/azure/AzureStorageUploader.cs b/azure/AzureStorageUploader.cs index 908bf27..9d20249 100644 --- a/azure/AzureStorageUploader.cs +++ b/azure/AzureStorageUploader.cs @@ -107,7 +107,14 @@ public async Task UploadBlobAsync( blobStream.Position = 0; - await outputBlob.UploadAsync(blobStream, cancellationToken: cancellationToken); + var inputBlobHeaders = await blob.GetPropertiesAsync(cancellationToken: cancellationToken); + + var httpHeader = new BlobHttpHeaders + { + ContentType = inputBlobHeaders?.Value.ContentType ?? "application/octet-stream" + }; + + await outputBlob.UploadAsync(blobStream, httpHeader, cancellationToken: cancellationToken); } }