Skip to content

Get Block List failed to deserialize #1440

@Gerrystev

Description

@Gerrystev

I encounter parsing xml error when trying to using get_block_list function.

Step to produce error

  1. Using azurite and run using docker hub
    docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 \
       -v /tmp/azurite mcr.microsoft.com/azure-storage/azurite 
    
  2. Run Using this code
       use anyhow::Result;
       use azure_storage_blobs::prelude::{ClientBuilder, BlockListType};
       #[tokio::main]
       pub async fn main() -> Result<()> {
           let client_container = ClientBuilder::emulator()
               .container_client("mycontainer");
           client_container
               .create()
               .await
               .ok();
    
           // Generate base64 string block id
           let block_id = "JGKOMgsURmnlQorQj";
           client_container
               .blob_client("myblob")
               .put_block(block_id, b"Hello".to_vec())
               .await?;
    
           let block_id = "JGKOMgsURxxxQorQj";
           client_container
               .blob_client("myblob")
               .put_block(block_id, b"world".to_vec())
               .await?;
    
           let res = client_container
               .blob_client("myblob")
               .get_block_list()
               .block_list_type(BlockListType::Uncommitted)
               .await?;
    
           println!("{:?}", res);
           Ok(())
       }
    
    will return:
    Error: failed to deserialize the following xml into a azure_storage_blobs::blob::block_with_size_list::BlockList
    ml version="1.0" encoding="UTF-8" standalone="yes"?><BlockList><CommittedBlocks/><UncommittedBlocks><Block><Name>SkdLT01nc1VSbW5sUW9yUWo=</Name><Size>5</Size></Block><Block><Name>SkdLT01nc1VSeHh4UW9yUWo=</Name><Size>5</Size></Block></UncommittedBlocks></BlockList>
    

Metadata

Metadata

Assignees

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