Open web-masta opened 8 months ago
@web-masta can you provide php code example?
try {
$archiveObject = new Archive7z($filePath);
} catch (\Throwable $e) {
$message = sprintf("Archive7z error, could not open file %d: %s",$file->id, $e->getMessage());
throw new FileException($message, $e->getCode(), $e);
}
try {
$entries = $archiveObject->getEntries();
} catch (\Throwable $e) {
$message = sprintf("Archive7z entries read error, file %d: %s", $file->id, $e->getMessage());
throw new FileException($message, $e->getCode(), $e);
}
...
Failing while trying to getEntries()
(and most of other methods as well) before it goes to catch.
@web-masta and what kind of behavior do you expect? At first glance, the behavior is correct. If the rest of the archive is in the directory, there will be no error.
I expect to somehow get the list of contents of those files. But I can see entries only in error message.
The problem is that different parts of archives can be uploaded in different directories, or even on different disks. This whole system of uploading was made ages ago and back then there was no need to look inside archives.
@web-masta but this will only be a partial list of files. falling into a part of the archive. you can ignore some exit codes and the partial list will work:
<?php
use Archive7z\Archive7z;
class MyArchive7z extends Archive7z
{
protected function execute(Process $process): Process
{
$exitCode = $process->run();
if ($exitCode > 2) {
throw new ProcessFailedException($process);
}
return $process;
}
}
Thank you! I will try this out.
Hello and thank you for this cool tool!
I have a problem with reading contents of divided into parts archives. The command is failing, however showing some contents.
File names are stored as hash values.
Is there a simple solution to, maybe, ignore or fix this type of error without archive modification? The process is failing before I can catch it in an easy way.
Example output: