When calling the func (b *Client) SetTags(ctx context.Context, tags map[string]string, options *SetTagsOptions) (SetTagsResponse, error) method with an empty tags map, the method panics:
The expected behaviour is that the method can be called with an empty tags map to remove all tags from the given blob. The method signature itself explicitly states this:
// SetTags operation enables users to set tags on a blob or specific blob version, but not snapshot.
// Each call to this operation replaces all existing tags attached to the blob.
// To remove all tags from the blob, call this operation with no tags set.
// https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tags
The Set Blob Tags operation overwrites all existing tags on the blob. To remove all tags from a blob, send a Set Blob Tags request with an empty <TagSet>.
For reference, here is the code that I am using to trigger the panic:
Bug Report
Import path:
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob
.SDK version:
v1.1.0
.Go version:
go version go1.21.0 darwin/arm64
.When calling the
func (b *Client) SetTags(ctx context.Context, tags map[string]string, options *SetTagsOptions) (SetTagsResponse, error)
method with an emptytags
map, the method panics:The expected behaviour is that the method can be called with an empty
tags
map to remove all tags from the given blob. The method signature itself explicitly states this:As does the official API documentation:
For reference, here is the code that I am using to trigger the panic:
I believe the issue is that
shared.SerializeBlobTags()
returnsnil
if the provided map is empty:This causes a nil pointer dereference later on:
Thanks.