Skip to content

Commit

Permalink
Copy over the ContentType of source blob for storage-encrypted blobs …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
weibz committed Aug 2, 2023
1 parent 79363b8 commit 3dd8b75
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion azure/AzureStorageUploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 3dd8b75

Please sign in to comment.