Fix azure storage content-type (#8294)

* fix azure storage content-type

* Use ?? instead of ||

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
José Varela
2021-09-24 19:06:29 +01:00
committed by GitHub
parent 2e7d640cf9
commit ca72073de3

View File

@@ -213,14 +213,20 @@ export class AzureBlobWebServicesStorage extends Storage {
return { raw: result };
}
public async put(location: string, content: Buffer | NodeJS.ReadableStream | string): Promise<Response> {
public async put(
location: string,
content: Buffer | NodeJS.ReadableStream | string,
type?: string
): Promise<Response> {
location = this._fullPath(location);
const blockBlobClient = this.$containerClient.getBlockBlobClient(location);
try {
if (isReadableStream(content)) {
const result = await blockBlobClient.uploadStream(content as Readable);
const result = await blockBlobClient.uploadStream(content as Readable, undefined, undefined, {
blobHTTPHeaders: { blobContentType: type ?? 'application/octet-stream' },
});
return { raw: result };
}