Skip to content

Gzip output getting mangled when piping to azure upload blob command #24761

@RicardsRikmanis

Description

@RicardsRikmanis

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
    SHOW VARIABLES;
  2. Run similar command to this:
    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
    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

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions