Azure / Azure/azure-storage-python

list_blobs() crashes due to response from blob storage not containing Creation-Time

未关闭
#629 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

feature request/enhancement
主要语言
Python
星标
343
派生
243
PR 合并指标
30 天内没有已合并 PR

描述

Which service(blob, file, queue) does this issue concern?

blob

Which version of the SDK was used? Please provide the output of pip freeze.

azure-storage-blob==2.1.0
azure-storage-common==2.1.0
azure-common==1.1.23

What problem was encountered?

Call to list_blobs(container_name) throws an error in the end when the blobs have been created by the client on an IoTEdgeBlobStorage. The issue is that the Creation-Time appears to be empty when the request returns from the IoTEdge module. eg:
`

     <Name>test.txt</Name>
     <Properties>
        <Creation-Time />
        <Last-Modified>Tue, 20 Aug 2019 08:12:37 GMT</Last-Modified>
        <Etag>0x8D7254629E53C01</Etag>
        <Content-Length>32</Content-Length>
        <Content-Type>application/octet-stream</Content-Type>
        <Content-Encoding />
        <Content-Language />
        <Content-MD5>DdOF7ew/k5qHSdf00h0hzg==</Content-MD5>
        <Cache-Control />
        <Content-Disposition />
        <BlobType>BlockBlob</BlobType>
        <LeaseStatus>unlocked</LeaseStatus>
        <LeaseState>available</LeaseState>
        <ServerEncrypted>false</ServerEncrypted>
     </Properties>
  </Blob>`

If you look at azure/storage/blob/_deserialization.py on you see something like setattr(blob.properties, info[1], info[2](property_element.text))

if the Creation-Time is empty this property_element.text is None which makes the call to the info[2] (parser.parse) crash

Have you found a mitigation/solution?

Yes and no. You could test to see if property_element.text is empty or not. But I don't know if this is the way to go. It's maybe better to make sure that the blob storage returns a Creation-Time property.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 azure/storage/blob/_deserialization.py 开始,跟踪围绕 Creation-Time 属性的 list_blobs 响应解析过程。使用 Creation-Time 为空的 Blob 响应重现该故障,然后确定预期的处理方式,并验证 list_blobs 能够完成且不会导致解析器崩溃。

由索引模型根据 Issue 内容生成。

评估

技术栈
azure, python
领域
backend, cloud
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。