Azure / Azure/azure-storage-python

create_blob_from_stream does not support string stream (StringIO or file in text mode)

オープン
#546 コメント 2 件 リアクション 0 件 担当者 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 4.0.0, blob 1.4.0

### What problem was encountered?

`create_blob_from_stream` says it supports `io.IOBase`, however it only supports bytes stream, not string/plain text stream or file.

Relevant function and error raised
```
def _get_data_bytes_only(param_name, param_value):
'''Validates the request body passed in and converts it to bytes
if our policy allows it.'''
if param_value is None:
return b''

if isinstance(param_value, bytes):
return param_value

> raise TypeError(_ERROR_VALUE_SHOULD_BE_BYTES.format(param_name))
E TypeError: foobar should be of type bytes.
```

### Have you found a mitigation/solution?

No.

Note: for table service, please post the issue here instead: https://github.com/Azure/azure-cosmosdb-python.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、レポートで言及されているエントリーポイント create_blob_from_stream とヘルパー _get_data_bytes_only を見つけます。テキストモードのファイルと StringIO がバイトストリームと比較してどのように扱われているかを確認し、その後、create_blob_from_stream が報告された文字列ストリーム入力を受け付け、バイトストリームの動作を後退させないことを検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
cloud
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。