Open sr-verde opened 1 year ago
Can be fixed using the is_fatal_error
fct of ZIP for the UnarchiverExtractor
:
class UnarchiverExtractor(NoPipeExtractor):
file_type = "RAR archive"
list_command = ["lsar"]
@property
def extract_command(self):
"""
Returns the extraction command and adds a password if given.
"""
cmd = ["unar", "-D"]
if self.password:
cmd.append("-p %s" % (self.password,))
return cmd
def get_filenames(self):
output = NoPipeExtractor.get_filenames(self)
next(output)
for line in output:
end_index = line.rfind("(")
yield line[:end_index].strip()
def is_fatal_error(self, status):
return (status or 0) > 1
What happens:
dtrx doesn't error on missing passwords on rar archives. I have a password protected archive containing one file
file1.txt
. When trying to extract the file, I’ll get a password prompt (that will be killed immediately) and after that there is a dirpassword-protected
that contains one empty file.What I expect:
dtrx should print an error "cannot extract encrypted archive" (as when trying to extract other archive types).
How can you reproduce it:
My log: