Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

Commit

Permalink
set content type when write blob storage
Browse files Browse the repository at this point in the history
  • Loading branch information
cocoa-dev006 committed Jun 14, 2022
1 parent 9591839 commit 895249f
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class TemporaryExposureKeyBlobService : ITemporaryExposureKeyBlobService
const string batchNumberMetadataKey = "batch_number";
const string batchRegionMetadataKey = "batch_region";
const string fileNameSuffix = ".zip";
private readonly static string _contentTypeJson = @"application/json";
private readonly static string _contentTypeZip = @"application/zip";

public readonly string TekExportKeyUrl;
public readonly string TekExportBlobStorageConnectionString;
Expand Down Expand Up @@ -62,6 +64,10 @@ public async Task WriteToBlobAsync(Stream s, TemporaryExposureKeyExportModel mod
blockBlob.Metadata[batchNumberMetadataKey] = model.BatchNum.ToString();
blockBlob.Metadata[batchRegionMetadataKey] = model.Region;

if(blockBlob.Properties.ContentType != _contentTypeZip)
{
blockBlob.Properties.ContentType = _contentTypeZip;
}
await blockBlob.UploadFromStreamAsync(s);
Logger.LogInformation($" {nameof(WriteToBlobAsync)} upload {exportFileName}");
await blockBlob.SetMetadataAsync();
Expand Down Expand Up @@ -120,6 +126,10 @@ public async Task WriteFilesJsonAsync(IEnumerable<TemporaryExposureKeyExportMode
await writer.FlushAsync();
await stream.FlushAsync();
stream.Position = 0;
if (blockBlob.Properties.ContentType != _contentTypeJson)
{
blockBlob.Properties.ContentType = _contentTypeJson;
}
await blockBlob.UploadFromStreamAsync(stream);
}
}
Expand Down

0 comments on commit 895249f

Please sign in to comment.