Skip to content

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

Description

@Cediddi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions