WordPress / WordPress/Requests

".tgz" files somtimes decompressed in error.

Open
#437 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.6k
Forks
500
Avg merge
2d 21h
Merged PRs (30d)
5

Description

Requests.php will mistakenly decompress a .tgz file (or other gzipped files) downloaded from sites that pass a "content-encoding: none" header.

In the case of .tgz files, you end up with a misnamed, uncompressed tar file. Often manageable, but not if there needs to be an md5/sha1/etc checksum confirmation.

The decompress code is wrapped by if (isset($return->headers['content-encoding'])), so the decompress code fires even though the encoding is "none". Should there be a check for a proper encoding type, or at minimum, check for "none" before decompressing?

Ran into this with bitbucket. A sample file to demonstrate the issue: https://bitbucket.org/jerrm-bb/testdownload/downloads/outcnam-test.tgz

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Requests.php at the decompression branch guarded by the response's content-encoding header. Reproduce the issue with the linked Bitbucket .tgz sample and inspect handling of the value "none". Done means files with content-encoding "none" are not decompressed and the downloaded archive remains suitable for checksum verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.