Azure / azure-storage-python

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

get_blob_to_stream API with special character throws azure.common.AzureMissingResourceHttpError #606

Closed HiranCser closed 5 years ago

HiranCser commented 5 years ago

blockblobservice.py

Output of pip freeze

azure-common==1.1.15 azure-nspkg==3.0.2 azure-storage-blob==1.3.1 azure-storage-common==1.3.0 azure-storage-nspkg==3.1.0

get_blob_to_stream API

with blob file path having special character ö results in azure.common.AzureMissingResourceHttpError exception.

Have you found a mitigation/solution? No

xiafu-msft commented 5 years ago

Hi @HiranCser Thanks so much for reaching out! I'm sorry that I wasn't able to reproduce the problem you met with the pip freeze you provided. Would you like to provide the container name and blob name you were using?

The blob name I was using is "öööööö1" and the container name I was using is "utcontainer1d572de1fc1147d0a90cb18c6ebcec3a". Here is the code I was using to test

self.bs = self._create_storage_service(BlockBlobService, self.settings) blob_name = "öööööö1" with open(FILE_PATH, 'wb') as stream: blob = self.bs.get_blob_to_stream("utcontainer1d572de1fc1147d0a90cb18c6ebcec3a", blob_name, stream) with open(FILE_PATH, 'rb') as stream: actual = stream.read() print(actual)

def _create_storage_service(self, service_class, settings): service = service_class( settings.STORAGE_ACCOUNT_NAME, settings.STORAGE_ACCOUNT_KEY, protocol=settings.PROTOCOL, ) return service

HiranCser commented 5 years ago

Hi xiafu-msft,

First of thank you for looking into this issue.

On careful investigation I found that it was issue with Azure blob update. Character ö was somehow changed to � and hence, this API was not working as we were using ö instead of � character.

Sorry for inconvenience.