From e1748a3183b90630778a8d1d3c8f3a4bd0705cdb Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 13 Dec 2024 14:49:45 +0000 Subject: [PATCH] azurefiles: fix missing x-ms-file-request-intent header According to the SDK docs > FileRequestIntent is required when using TokenCredential for > authentication. Acceptable value is backup. This sets the correct option in the SDK. It does it for all types of authentication but the SDK seems clever enough not to supply it when it isn't needed. This fixes the error > MissingRequiredHeader An HTTP header that's mandatory for this > request is not specified. x-ms-file-request-intent Fixes #8241 --- backend/azurefiles/azurefiles.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/azurefiles/azurefiles.go b/backend/azurefiles/azurefiles.go index 0cae6620f..acff5be19 100644 --- a/backend/azurefiles/azurefiles.go +++ b/backend/azurefiles/azurefiles.go @@ -393,8 +393,10 @@ func newFsFromOptions(ctx context.Context, name, root string, opt *Options) (fs. policyClientOptions := policy.ClientOptions{ Transport: newTransporter(ctx), } + backup := service.ShareTokenIntentBackup clientOpt := service.ClientOptions{ - ClientOptions: policyClientOptions, + ClientOptions: policyClientOptions, + FileRequestIntent: &backup, } // Here we auth by setting one of cred, sharedKeyCred or f.client