Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch and copy HTTP headers if they are being updated #10101

Merged
merged 4 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions .pipelines/NuGetGallery-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,9 @@ trigger:
- "*"
batch: True

parameters:
- name: BuildConfiguration
displayName: Build configuration
type: string
default: Release
values: ["Release", "Debug"]

variables:
- name: BuildConfiguration
value: ${{ parameters.BuildConfiguration }}
value: Release
- name: Codeql.Enabled
value: true
- name: NugetSecurityAnalysisWarningLevel
Expand Down
17 changes: 14 additions & 3 deletions src/Catalog/Persistence/AzureStorage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
Expand Down Expand Up @@ -247,8 +247,19 @@ protected override async Task OnCopyAsync(
// Set destination properties if provided
if (destinationProperties?.Count > 0)
{
BlobHttpHeaders headers = new BlobHttpHeaders();

// Use the existing properties of the destination blob to ensure that all properties are copied
// Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-properties-metadata#set-and-retrieve-properties
BlobProperties properties = await destinationBlockBlob.GetPropertiesAsync();
var headers = new BlobHttpHeaders
{
CacheControl = properties.CacheControl,
ContentType = properties.ContentType,
ContentDisposition = properties.ContentDisposition,
ContentEncoding = properties.ContentEncoding,
ContentLanguage = properties.ContentLanguage,
ContentHash = properties.ContentHash,
};

// The copy statement copied all properties from the source blob to the destination blob; however,
// there may be required properties on destination blob, all of which may have not already existed
// on the source blob at the time of copy.
Expand Down