From 39435df534950871bfaeffbbf8e269e449768db0 Mon Sep 17 00:00:00 2001 From: Ilia Rostovtsev Date: Thu, 5 Apr 2018 15:19:26 +0300 Subject: [PATCH] Fix to respect vendor-specific (rar) MIME type https://github.com/webmin/webmin/issues/702 --- filemin/extract.cgi | 2 +- filemin/filemin-lib.pl | 42 +++++++++--------- .../images/icons/mime/application-vnd.rar.png | Bin 0 -> 968 bytes 3 files changed, 21 insertions(+), 23 deletions(-) create mode 100644 filemin/images/icons/mime/application-vnd.rar.png diff --git a/filemin/extract.cgi b/filemin/extract.cgi index b9eb63983..55a1a3af4 100755 --- a/filemin/extract.cgi +++ b/filemin/extract.cgi @@ -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); } diff --git a/filemin/filemin-lib.pl b/filemin/filemin-lib.pl index 3cc6cb51b..f634ff07d 100644 --- a/filemin/filemin-lib.pl +++ b/filemin/filemin-lib.pl @@ -339,28 +339,26 @@ 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-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 $extract_icon "; - } + 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 $extract_icon "; + } + } @row_data = ( "", diff --git a/filemin/images/icons/mime/application-vnd.rar.png b/filemin/images/icons/mime/application-vnd.rar.png new file mode 100644 index 0000000000000000000000000000000000000000..8d91396fa933ae58c95414b04b1292e5274277a7 GIT binary patch literal 968 zcmV;(12_DMP)yG)4(t5Q5W-xauy;WG8}+ z3laSr1eflNGz-a2{2z)WNGxi1v+71D3Z;l?wW*h(iISutoy^R+%z0hRCAB7F!1v>P z-?#YA!|!|Emm{hQfQXcUBLA;~s(JuXRjz%!@y@F+URW*^3KwPgiO8wDMc|_^K458S z2~}ldV}noM{hScuPd_&|m*4wjY0Zg9`Q~RoT=n~*-icih=`)4l?O$aJ!q(On^Yiln ztgf!|c;^V<;>**oTosY89Z)iA>+Nj8NyFXY%S$-nOdy|z{JD^Ju_%cpq&QelzMrr(Dk@E?;|lp zR5BThnDHul+5=#5agj!&0YKIsF+{}6D6zy&Ao@rexE{JXZE5b$exuP~VPT;U&Y9>V zu@jCR`)=rOKyjK8JDRr>D{DR>u@ZblMW0CAJx&|LFm*h24Z;6NteNCTj>Q2+jS@mc zt>Q#6JsB66&mFWt$U=aZsM;??8u0plQbLXdN@3q;!|K~Ay zQ|=sgZ--~9wJNUUFlM}pr|9IYB%e5H9r5er-NO-h`|^F!?{n+fquE-aSHS$oR6I@2 zJtg|c?&NlB=kf#Ln?duM+MJwPnxb2?WLw0DIg<(iRV8aC^a9=1qgwN~CJdXG4r=LE zxaBI93Z+5`XBGIb-6iq@0K; zQg$yfTYkgc;ifns|Mfe2m+Bu*Pt}Tu2xg#o{2AAu3KX*Tl^nDJckkWX1F{2le);ap zZ`+->-kdx)d(IfJ#$b(Lj9^Xw;J1T6=w(G!>18G7{kIQPtXl)0$-`>kADM*5c$Vy`;O)S0000