Azure / azure-storage-python

Microsoft Azure Storage Library for Python
https://azure-storage.readthedocs.io
MIT License
339 stars 241 forks source link

Registered Trademark symbol fine in portal but erroring due to invalid metadata #527

Closed wjohnson closed 5 years ago

wjohnson commented 5 years ago

Which service(blob, file, queue) does this issue concern?

blob

Which version of the SDK was used? Please provide the output of pip freeze.

azure-common==1.1.16 azure-nspkg==3.0.2 azure-storage-blob==1.3.1 azure-storage-common==1.3.0 azure-storage-file==1.3.1 azure-storage-nspkg==3.0.0

What problem was encountered?

When copying a file share file that contains the registered trademark symbol (Unicode: U+00AE; url encoded: %C2%AE) to a blob, I receive a 400 error stating that there are illegal characters in the metadata. However, when I upload that same file to blob via the portal, no problem.

HTTP status code=400, Exception=The metadata specified is invalid. 
It has characters that are not permitted. ErrorCode: InvalidMetadata
<?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidMetadata</Code>
<Message>The metadata specified is invalid. It has characters that are not permitted.

So, when I go to url encode the symbol to %C2%AE, it doesn't render as the (R) symbol in the portal, instead it shows %C2%AE and when I actually browse to the file it's further url encoded to be %25C2%25AE (encoding the % symbols as %25).

Have you found a mitigation/solution?

My workaround is to just accept the encoding of the percent symbols. Ideally, I'd like to keep the original file name with the registered trademark as it appears in the file share and in the blob when manually uploaded.

rickle-msft commented 5 years ago

Thank you, @wjohnson for posting this issue. I have logged this issue for investigation, and we will get back to you as soon as we have more information.

xiafu-msft commented 5 years ago

Hi @wjohnson Thanks for your patience, not sure if the problem is resolved. I'm sorry that I wasn't able to reproduce this problem. Also I found it is similar to https://github.com/Azure/azure-storage-python/issues/606

We didn't get your update, so we assumed maybe you find the solution. close this issue currently, feel free to reopen this if you need extra help.