Azure / Azure/azure-storage-python
create_blob_from_stream does not support string stream (StringIO or file in text mode)
- Vorherrschende Sprache
- Python
- Sterne
- 343
- Forks
- 243
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
### 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.
Beitragsleitfaden
Rechercherichtung
Start by locating the create_blob_from_stream entry point and the _get_data_bytes_only helper mentioned in the report. Check how text-mode files and StringIO are handled versus byte streams, then verify that create_blob_from_stream accepts the reported string-stream inputs without regressing byte-stream behavior.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- cloud
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100