I'm using a combination of C# and JS to upload a file to Azure storage (using C# I create a SaS URL for the blob and JS just to upload the file through the browser). I have a problem with Blob ContentType. When I create a Blob using C# by loading string.Empty
blobClient.Upload(string.Empty, new BlobHttpHeaders()
{
ContentDisposition = "newFile.png",
ContentType = "image/png"
});
Everything is fine in the Azure portal, but when I upload the file using JS ("@azure/storage-blob" https://docs.microsoft.com/en-us/javascript/api/@azure/storage-blob/blockblobclient?view=azure-node-latest#@azure-storage-blob-blockblobclient-uploaddata)
await blockBlobClient.uploadData(file);
It will overwrite ContentType.
I could use
await blockBlobClient.uploadData(file, {
blobHTTPHeaders:{
blobContentDisposition: file.name,
blobContentType: file.type
}
});
But I don't want to use it in JS because anyone can write anything in Source. Is there any way to use something like Static ContentType for blob or inject in SaS ContentType (injection in BlobSasBuilder doesn't work)