简体   繁体   中英

Setting Azure Blob Index tags with parenthesis - works in Browser but not in REST API

I have been trying to set some blob tags and receiving a horrible error:

Response: HTTP/1.1 400 The tags specified are invalid. It contains characters that are not permitted.

I can set the tags with the same value in container browser without any issue, but via REST api it always fails with parenthesis, I have tried encoding in several ways, but the only way to success is to omit the patenthesis (which I am currently doing).

Successful payload:

 <Tags> <TagSet> <Tag> <Key>FileID</Key> <Value>307145362</Value> </Tag> <Tag> <Key>FileName</Key> <Value>/omit/gkcs2022-11-15 14.49.12.log</Value> </Tag> <Tag> <Key>FileType</Key> <Value>GKCS Log File</Value> </Tag> <Tag> <Key>DeviceID</Key> <Value>151283</Value> </Tag> <Tag> <Key>Timestamp</Key> <Value>2023-01-20T144920.192Z</Value> </Tag> <Tag> <Key>DOWNLOADEDTO_GBMSVINTELLIFS</Key> <Value>False</Value> </Tag> </TagSet> </Tags>

Failing Payloads:

Raw:

 <Tags> <TagSet> <Tag> <Key>FileID</Key> <Value>307145362</Value> </Tag> <Tag> <Key>FileName</Key> <Value>/omitted/gkcs(2022-11-15 14.49.12).log</Value> </Tag> <Tag> <Key>FileType</Key> <Value>GKCS Log File</Value> </Tag> <Tag> <Key>DeviceID</Key> <Value>151283</Value> </Tag> <Tag> <Key>Timestamp</Key> <Value>2023-01-20T144920.192Z</Value> </Tag> <Tag> <Key>DOWNLOADEDTO_GBMSVINTELLIFS</Key> <Value>False</Value> </Tag> </TagSet> </Tags>

URL Encoding:

 <Tags> <TagSet> <Tag> <Key>FileID</Key> <Value>307145362</Value> </Tag> <Tag> <Key>FileName</Key> <Value>/omit/gkcs%282022-11-15 14.49.12%29.log</Value> </Tag> <Tag> <Key>FileType</Key> <Value>GKCS Log File</Value> </Tag> <Tag> <Key>DeviceID</Key> <Value>151283</Value> </Tag> <Tag> <Key>Timestamp</Key> <Value>2023-01-20T144920.192Z</Value> </Tag> <Tag> <Key>DOWNLOADEDTO_GBMSVINTELLIFS</Key> <Value>False</Value> </Tag> </TagSet> </Tags>

Escape Character:

 <Tags> <TagSet> <Tag> <Key>FileID</Key> <Value>307145362</Value> </Tag> <Tag> <Key>FileName</Key> <Value>/omit/gkcs\(2022-11-15 14.49.12\(.log</Value> </Tag> <Tag> <Key>FileType</Key> <Value>GKCS Log File</Value> </Tag> <Tag> <Key>DeviceID</Key> <Value>151283</Value> </Tag> <Tag> <Key>Timestamp</Key> <Value>2023-01-20T144920.192Z</Value> </Tag> <Tag> <Key>DOWNLOADEDTO_GBMSVINTELLIFS</Key> <Value>False</Value> </Tag> </TagSet> </Tags>

As per Azure Storage documentation , only the following characters can be used in valid tag keys and values:

  • Lowercase and uppercase letters (az, AZ)
  • Digits (0-9)
  • A space ( )
  • Plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), and underscore (_)

Unfortunately, parenthesis characters are not currently supported by the Set Blob Tags REST API request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM