Add support for extracting .iso and .img files

This commit is contained in:
Ilia Rostovtsev
2021-11-08 13:46:19 +03:00
parent 416afebffe
commit 0ec3e7ba9d
2 changed files with 11 additions and 3 deletions

View File

@@ -16,7 +16,9 @@ elsif ($archive_type =~ /x-tar|\/gzip|x-xz|x-compressed-tar/) {
$cmd = "tar xfp ".quotemeta("$cwd/$in{'file'}").
" -C ".quotemeta($cwd);
}
elsif ($archive_type =~ /x-7z/) {
elsif ($archive_type =~ /x-7z/ ||
$archive_type =~ /x-raw-disk-image/ ||
$archive_type =~ /x-cd-image/) {
$cmd = "7z x ".quotemeta("$cwd/$in{'file'}")." -o" .quotemeta($cwd);
}
elsif ($archive_type =~ /\/zip/) {

View File

@@ -371,7 +371,11 @@ 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-7z-compressed") != -1 ||
index($type, "x-raw-disk-image") != -1 ||
index($type, "x-cd-image") != -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'))
@@ -518,7 +522,9 @@ foreach my $fref (@{$files_to_extract}) {
} else {
$status = system("$xz_cmd -d -f -k " . quotemeta("$cwd/$name"));
}
} elsif ($archive_type =~ /x-7z/) {
} elsif ($archive_type =~ /x-7z/ ||
$archive_type =~ /x-raw-disk-image/ ||
$archive_type =~ /x-cd-image/) {
my $x7z_cmd = has_command('7z');
if (!$x7z_cmd) {
push(@errors, &text('extract_cmd_not_avail', "<tt>" . &html_escape($name) . "</tt>", '<tt>7z</tt>'));