Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to extract RAR successfully. #3151

Closed
innominata opened this issue Apr 21, 2020 · 3 comments
Closed

Unable to extract RAR successfully. #3151

innominata opened this issue Apr 21, 2020 · 3 comments

Comments

@innominata
Copy link

innominata commented Apr 21, 2020

Hi there, if I create a RAR file with the context menu that has more than one file in it, it fails to extract more than the first file. (also with every other externally sourced RAR file I've tried)

I believe that the quarantine directory is being removed before the second file is copied?

I had a quick poke at elFinderVolumeLocalFileSystem.class.php but couldn't stop the quarantine directory being deleted.

Creating a ZIP, tar.gz, 7z of the same structure works fine.

Ubuntu 18.04, downloaded via composer script this morning. manually running the rar command works fine, and If I'm quick i can catch the quarantine directory having the data in it for a split second

@nao-pon
Copy link
Member

nao-pon commented May 30, 2020

@innominata The rar command cannot be used in my environment and cannot be examined in detail. What is the option specification of the rar command made manually?

@667bdrm
Copy link
Member

667bdrm commented Jun 4, 2020

I was able to reproduce this. Quick workaround: set maxArcFilesSize option to 0 (unlimited). Looks like the problem in file size calculation. RAR can be downloaded at https://www.rarlab.com/. In my case (ubuntu) it cold be installed as 'apt install rar'.
elf1.zip: elf1.rar inside - github does not support rar attachments

--- elFinderVolumeDriver.class.php.orig	2020-05-12 08:32:00.000000000 +0300
+++ elFinderVolumeDriver.class.php	2020-06-04 17:16:18.064460601 +0300
@@ -6643,6 +6643,7 @@
     protected function getArchivers($use_cache = true)
     {
         $sessionKey = 'archivers';
+
         if ($use_cache) {
             if (isset($this->options['archivers']) && is_array($this->options['archivers']) && $this->options['archivers']) {
                 $cache = $this->options['archivers'];
@@ -6701,6 +6702,7 @@
             }
             unset($o);
             $this->procExec(ELFINDER_RAR_PATH . ' --version', $o, $c);
+
             if ($c == 0 || $c == 7) {
                 $arcs['create']['application/x-rar'] = array('cmd' => ELFINDER_RAR_PATH, 'argc' => 'a -inul', 'ext' => 'rar');
             }
@@ -6902,7 +6904,10 @@
                             $size = preg_replace($getsize['regex'], $getsize['replace'], trim($o));
                             $comp = function_exists('bccomp')? 'bccomp' : 'strnatcmp';
                             if (!empty($this->options['maxArcFilesSize'])) {
+                                error_log('chp5:'. $this->options['maxArcFilesSize']);
                                 if ($comp($size, (string)$this->options['maxArcFilesSize']) > 0) {
+                                    error_log('chp6:'. $this->options['maxArcFilesSize']);
+                                    error_log('chp7:'. $size);
                                     throw new Exception(elFinder::ERROR_ARC_MAXSIZE);
                                 }
                             }

And here is a log that I'm getting:

[Thu Jun 04 16:55:02.621365 2020] [php7:notice] [pid 329707] [client 127.0.0.1:45728] chp5:2147483648, referer: http://d9.local/admin/content/elfinder
[Thu Jun 04 16:55:02.621397 2020] [php7:notice] [pid 329707] [client 127.0.0.1:45728] chp6:2147483648, referer: http://d9.local/admin/content/elfinder
[Thu Jun 04 16:55:02.621406 2020] [php7:notice] [pid 329707] [client 127.0.0.1:45728] chp7:UNRAR 5.61 beta 1 freeware      Copyright (c) 1993-2018 Alexander Roshal\n\nArchive: /var/www/d9/web
/sites/default/files/elf2/elf1.rar\nDetails: RAR 5\n\n Attributes      Size     Date    Time   Name\n----------- ---------  ---------- -----  ----\n -rw-rw-rw-   1171780  2020-06-04 12:30  elf1/datasheet/Ge
mtek_Instruction_PO.pdf\n -rw-rw-rw-    544305  2020-06-04 12:30  elf1/datasheet/???????????-quattro-elementti.pdf\n -rw-rw-rw-    219415  2020-06-04 12:30  elf1/datasheet/TEC-6050-7 ???????????????????????
 ???????????????? CANTEC F2 v5.pdf\n -rw-rw-rw-    179687  2020-06-04 12:30  elf1/datasheet/TEC-6060-7 ??????????????????????? ???????????????? CANTEC F1 v5.pdf\n -rw-rw-rw-     61936  2020-06-04 12:30  elf
1/datasheet/stm32_drm_en.DM00033344.pdf\n -rw-rw-r--   1772278  2020-06-04 12:31  elf1/datasheet.rar\n drwxrwxr-x         0  2020-06-04 16:41  elf1/datasheet\n drwxr-xr-x         0  2020-06-04 15:58  elf1\n
----------- ---------  ---------- -----  ----\n              3949401                    8, referer: http://d9.local/admin/content/elfinder

Looks like in the $size all extract command output.

@nao-pon nao-pon self-assigned this Jun 5, 2020
@nao-pon
Copy link
Member

nao-pon commented Jun 5, 2020

@667bdrm @innominata The sizing process is not adapting to UNRAR 5, so I fix it.

Thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants