From 3e9f60a29f11c16c17e812e4f4cbb0ccd3f3b988 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Fri, 29 Mar 2024 02:44:32 +0000 Subject: [PATCH] fix: allow special char in tag value --- pkg/azuredisk/azure_managedDiskController.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/azuredisk/azure_managedDiskController.go b/pkg/azuredisk/azure_managedDiskController.go index 630e96f07c..21f30ca3b2 100644 --- a/pkg/azuredisk/azure_managedDiskController.go +++ b/pkg/azuredisk/azure_managedDiskController.go @@ -124,10 +124,10 @@ func (c *ManagedDiskController) CreateManagedDisk(ctx context.Context, options * newTags[consts.CreatedByTag] = &azureDDTag if options.Tags != nil { for k, v := range options.Tags { - // Azure won't allow / (forward slash) in tags - newKey := strings.Replace(k, "/", "-", -1) - newValue := strings.Replace(v, "/", "-", -1) - newTags[newKey] = &newValue + // <>%&?/. are not allowed in tag key, but allowed in tag value + newKey := strings.NewReplacer("<", "-", ">", "-", "%", "-", "&", "-", "?", "-", "/", "-").Replace(k) + value := v + newTags[newKey] = &value } }