Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Blob Storage get_object_cdn_url can't handle files with spaces. #1805

Open
Cediddi opened this issue Nov 30, 2022 · 0 comments
Open

Azure Blob Storage get_object_cdn_url can't handle files with spaces. #1805

Cediddi opened this issue Nov 30, 2022 · 0 comments

Comments

@Cediddi
Copy link

Cediddi commented Nov 30, 2022

Summary

I've been trying to generate a signed download link to a file with spaces in its name, let's call it file name.txt, and it has been failing to generate a token. While, If I use Azure's frontend, I can generate a token that works. I suspect the signature is calculated incorrectly.

Detailed Information

I had theorized that, azure don't urlencode the resource because it would be pointless if you are going to hash it. I've checked the official implementation and indeed they don't and use raw resource name when creating the signature. After that, I've created a subclass of AzureBlobsStorageDriver with get_object_cdn_url overloaded, and I've edited the string_to_sign's content with this:

+ "/blob/{}{}".format(self.key, unquote(object_path)),
- "/blob/{}{}".format(self.key, object_path),

And indeed it works now for any file I tried.

My Environment:
python==3.10.5
libcloud==3.6.0
operating system is official python:3.10 from docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant