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 storage blobs: BlobClient::url does not URL-encode blob names #1350

Closed
DrChat opened this issue Aug 31, 2023 · 0 comments · Fixed by #1379
Closed

Azure storage blobs: BlobClient::url does not URL-encode blob names #1350

DrChat opened this issue Aug 31, 2023 · 0 comments · Fixed by #1379

Comments

@DrChat
Copy link

DrChat commented Aug 31, 2023

Blob names must be URL-encoded in order to access the blob service.
Note that this bug is likely not limited to just BlobClient::url, but that is the specific case I'm running into.

pub fn url(&self) -> azure_core::Result<url::Url> {
let blob_name = self
.blob_name()
.strip_prefix('/')
.unwrap_or_else(|| self.blob_name());
let url = format!("{}/{}", self.container_client().url()?, blob_name);
Ok(url::Url::parse(&url)?)
}

Reference: https://learn.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#resource-names

demoray pushed a commit to demoray/azure-sdk-for-rust that referenced this issue Sep 13, 2023
This moves away from using `format`, which causes blob names to not be
URL encoded appropriately.

This should address Azure#1350
@demoray demoray linked a pull request Sep 14, 2023 that will close this issue
demoray added a commit that referenced this issue Sep 18, 2023
This moves away from using `format`, which causes blob names to not be
URL encoded appropriately.

This should address #1350
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

Successfully merging a pull request may close this issue.

1 participant