From 0ec3e7ba9db42e6a2bb19b9c6df67523d4d9d9c5 Mon Sep 17 00:00:00 2001 From: Ilia Rostovtsev Date: Mon, 8 Nov 2021 13:46:19 +0300 Subject: [PATCH] Add support for extracting `.iso` and `.img` files --- filemin/extract.cgi | 4 +++- filemin/filemin-lib.pl | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/filemin/extract.cgi b/filemin/extract.cgi index 82560ae25..b9c95a3cc 100755 --- a/filemin/extract.cgi +++ b/filemin/extract.cgi @@ -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/) { diff --git a/filemin/filemin-lib.pl b/filemin/filemin-lib.pl index 0808c1fe9..b2169fb28 100644 --- a/filemin/filemin-lib.pl +++ b/filemin/filemin-lib.pl @@ -371,7 +371,11 @@ sub print_interface { $actions = "$actions$edit_icon"; } 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', "" . &html_escape($name) . "", '7z'));