Azure / Azure/azure-storage-python

BaseBlobService.get_blob_to_stream returns unusable Blob.content

未关闭
#538 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
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==1.4.0
azure-storage-common==1.4.0
azure-storage-file==1.4.0
azure-storage-nspkg==3.0.0
azure-storage-queue==1.4.0
```

### What problem was encountered?

```python
import io
from azure.storage.blob.baseblobservice import BaseBlobService

blob_service = BaseBlobService(connection_string="...")
stream = io.BytesIO()
blob_file = blob_service.get_blob_to_stream("...", "...", stream=stream)

type(blob_file.content)
```
prints `NoneType`

What is the rationale for returning an empty [Blob.content](https://azure-storage.readthedocs.io/ref/azure.storage.blob.models.html#azure.storage.blob.models.Blob) in this case? I should be able to use `Blob.content`, instead I'm required to pass a `stream` object and use that one, which appears inconsistent with the rest of the get_blob_* methods based on `Blob.content` (e.g. `get_blob_to_text`, `get_blob_to_bytes`.

贡献指南

打开贡献指南

调研方向

从 azure.storage.blob.baseblobservice.BaseBlobService.get_blob_to_stream 开始,检查提供 stream 时返回的 Blob 是如何填充的。将其 Blob.content 行为与 get_blob_to_text 和 get_blob_to_bytes 进行比较;当行为保持一致,或明确记录其原因和预期用法时,即视为完成。

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

评估

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

把新 issue 发到你的邮箱

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