Azure / Azure/azure-cli

Gzip output getting mangled when piping to azure upload blob command

Open
#24,761 1 comment 0 reactions 2 assignees Claimed by @calvinhzy View on GitHub
act-codegen-extensibility-squad Auto-Assign Azure CLI Team customer-reported feature-request Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Related command**
`az storage blob upload --data @-`

**Describe the bug**
Gzip output is getting mangled when piping to azure upload blob command. No such issue if I split the the command, save the gziped file locally and then upload the file without the pipe. I'm pretty sure it has something to do with encoding getting mangled.

**To Reproduce**
1. Have any file, for example - **test.sql**
```sql
SHOW VARIABLES;
```
2. Run similar command to this:
```bash
cat test.sql | gzip | az storage blob upload --data @- -n test.sql.gz --account-name "$ACCOUNT" --container-name "$CONTAINER" --sas-token "$SAS_TOKEN
```
3. Afterwards download the uploaded file from Azure Storage, attempt to un-compress it
```bash
zcat test.sql.gz
gzip: test.sql.gz: not in gzip format
```

**Expected behavior**
Gzip output can be piped to azure upload blob command without corrupting data.

**Environment summary**
**OS** - Debian 10
**azure-cli** - 2.42.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.