From dc3e083bf01ba9b22a235c2602012740ad0edb44 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 6 Nov 2018 21:43:34 -0500 Subject: [PATCH] set filename with ContentDisposition --- .../Implementations/AzureAttachmentStorageService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Core/Services/Implementations/AzureAttachmentStorageService.cs b/src/Core/Services/Implementations/AzureAttachmentStorageService.cs index 4440bb4b80..0d535a5e4c 100644 --- a/src/Core/Services/Implementations/AzureAttachmentStorageService.cs +++ b/src/Core/Services/Implementations/AzureAttachmentStorageService.cs @@ -34,7 +34,7 @@ namespace Bit.Core.Services { blob.Metadata.Add("organizationId", cipher.OrganizationId.Value.ToString()); } - blob.Properties.ContentDisposition = "attachment"; + blob.Properties.ContentDisposition = $"attachment; filename=\"{attachmentId}\""; await blob.UploadFromStreamAsync(stream); } @@ -44,7 +44,8 @@ namespace Bit.Core.Services var blob = _attachmentsContainer.GetBlockBlobReference($"temp/{cipherId}/{organizationId}/{attachmentId}"); blob.Metadata.Add("cipherId", cipherId.ToString()); blob.Metadata.Add("organizationId", organizationId.ToString()); - blob.Properties.ContentDisposition = "attachment"; + blob.Properties.ContentDisposition = $"attachment; filename=\"{attachmentId}\""; + await blob.SetPropertiesAsync(); await blob.UploadFromStreamAsync(stream); }