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

Commit

Permalink
Merge pull request #1036 from cocoa-mhlw/fix/set_content_type_when_wi…
Browse files Browse the repository at this point in the history
…rte_blob_storage

set content type when write blob storage
  • Loading branch information
cocoa-dev006 authored Jun 14, 2022
2 parents 9591839 + 895249f commit 1f95e85
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 1f95e85

Please sign in to comment.