When trying to install a module from the "Upload a module or theme archive to install" field in the "Install New Module" dialog, I'm getting the following error when I try to use /home/user/code/drupal7/views-7.x-3.x-dev.tar.gz:

For security reasons, your upload has been renamed to views-7.x-3.x-dev.tar_.gz.
Error message
Cannot extract temporary://views-7.x-3.x-dev.tar_.gz, not a valid archive.

The archive is valid, however, and can be extracted via the shell with tar -xvzf, without any problems.

I was able to fix the problem and upload the module, by renaming the file to have the extension ".tgz" before uploading. But the instructions underneath the form fields both use files with "tar.gz" extensions in the example.

Comments

Garrett Albright’s picture

Version: 7.0-alpha4 » 7.x-dev
StatusFileSize
new1.13 KB

The correct answer is to make it work with files with .tar.gz. The quick and dirty answer is to change the description text to use .tgz instead (and also fix t() abuse).

Garrett Albright’s picture

Status: Active » Needs review
dhthwy’s picture

This is a bug. Code is already in place for it to work with tar, tgz, tar.gz, tar.bz2.

dhthwy’s picture

StatusFileSize
new630 bytes

The problem is that archives are being munged with file_munge_filename() and the check for valid archive extensions don't account for that. I'm assuming it is because archives are not really supposed to be munged, and I don't think they need to be munged. So here is a simple patch which adds them to the whitelist.

dhthwy’s picture

Title: "Install new module" dialog breaks with tar.gz extensions, but works with tgz. » Munging archive extensions breaks module installer

I guess this title better reflects the issue.

dhthwy’s picture

Priority: Normal » Critical

Oh well, as much as I hate to do this I think this is critical since it breaks the module installer.

dhthwy’s picture

Component: base system » file system
catch’s picture

Status: Needs review » Closed (duplicate)