in my dart/flutter project I want to upload some blob-data to azure. I am using the package azblob. There I am allowed to add headers to the request and I want to give the headers request the "x-ms-range"
to set tags.
I have following demo the upload to azure – it works, when I do not set the header argument:
Map<String, String> headers = { "x-ms-range": "VIN=TEST1" };
await storage.putBlob('/$container/$key.txt', body: 'Halllooo',headers: headers);
From the azure server, I get following exception:
<?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidMetadata</Code><Message>The metadata specified is invalid. It has characters that are not permitted.
Did I need extra formatting of the header? – or what I am doing wrong?
Thanks..
2
Answers
I have made a SQL-Table to store these metadatas, I was not able to figure out what was the problem. - Thanks for your answer!
The error message is saying that the metadata you are trying to set is invalid. The "x-ms-range" header is used to specify a range of bytes to upload, not to set tags. To set tags on a blob, you should use the "x-ms-meta-" prefix followed by the key of the tag. For example, to set a tag with the key "VIN" and the value "TEST1", you should use the header "x-ms-meta-VIN: TEST1"