Fix to respect vendor-specific (rar) MIME type https://github.com/webmin/webmin/issues/702

This commit is contained in:
Ilia Rostovtsev
2018-04-05 15:19:26 +03:00
parent 61b2c4c533
commit 39435df534
3 changed files with 21 additions and 23 deletions

View File

@@ -24,7 +24,7 @@ elsif ($archive_type =~ /x-7z/) {
elsif ($archive_type =~ /\/zip/) {
$cmd = "unzip ".quotemeta("$cwd/$in{'file'}")." -d ".quotemeta($cwd);
}
elsif ($archive_type =~ /\/x-rar/) {
elsif ($archive_type =~ /\/x-rar|\/vnd\.rar/) {
$cmd = "unrar x -r -y ".quotemeta("$cwd/$in{'file'}").
" ".quotemeta($cwd);
}

View File

@@ -339,28 +339,26 @@ sub print_interface {
) {
$actions = "$actions<a class='action-link' href='edit_file.cgi?file=".&urlize($link)."&path=".&urlize($path)."' title='$text{'edit'}' data-container='body'>$edit_icon</a>";
}
if ( ( index( $type, "application-zip" ) != -1 && has_command('unzip') )
|| ( index( $type, "application-x-7z-compressed" ) != -1 && has_command('7z') )
|| ( index( $type, "application-x-rar" ) != -1 && has_command('unrar') )
|| ( index( $type, "application-x-rpm" ) != -1 && has_command('rpm2cpio') && has_command('cpio') )
|| ( index( $type, "application-x-deb" ) != -1 && has_command('dpkg') )
|| (( index( $type, "x-compressed-tar" ) != -1
|| index( $type, "-x-tar" ) != -1
|| ( index( $type, "-x-bzip" ) != -1 && has_command('bzip2') )
|| ( index( $type, "-gzip" ) != -1 && has_command('gzip') )
|| ( index( $type, "-x-xz" ) != -1 && has_command('xz') )
)
&& has_command('tar')
)
)
{
$actions
= "$actions <a class='action-link' href='extract.cgi?path="
. &urlize($path)
. "&file="
. &urlize($link)
. "' title='$text{'extract_archive'}' data-container='body'>$extract_icon</a> ";
}
if ((index($type, "application-zip") != -1 && has_command('unzip')) ||
(index($type, "application-x-7z-compressed") != -1 && has_command('7z')) ||
((index($type, "application-x-rar") != -1 || index($type, "application-vnd.rar") != -1) && has_command('unrar')) ||
(index($type, "application-x-rpm") != -1 && has_command('rpm2cpio') && has_command('cpio')) ||
(index($type, "application-x-deb") != -1 && has_command('dpkg'))
||
(
(index($type, "x-compressed-tar") != -1 ||
index($type, "-x-tar") != -1 ||
(index($type, "-x-bzip") != -1 && has_command('bzip2')) ||
(index($type, "-gzip") != -1 && has_command('gzip')) ||
(index($type, "-x-xz") != -1 && has_command('xz'))
) &&
has_command('tar')))
{
$actions =
"$actions <a class='action-link' href='extract.cgi?path=" . &urlize($path) .
"&file=" . &urlize($link) . "' title='$text{'extract_archive'}' data-container='body'>$extract_icon</a> ";
}
}
@row_data = (
"<a href='$href'><img src=\"$img\"></a>",

Binary file not shown.

After

Width:  |  Height:  |  Size: 968 B