pyaff4 icon indicating copy to clipboard operation
pyaff4 copied to clipboard

Undefined Variable 'file'

Open forensicmatt opened this issue 6 years ago • 2 comments

Undefined variable error in extract function:

Traceback (most recent call last):
  File "C:\test\pyaff4-master\aff4.py", line 421, in <module>
    main(sys.argv)
  File "C:\test\pyaff4-master\aff4.py", line 411, in main
    extract(dest, args.srcFiles, args.folder)
  File "C:\test\pyaff4-master\aff4.py", line 331, in extract
    printVolumeInfo(file, volume)
NameError: name 'file' is not defined

forensicmatt avatar Aug 20 '19 18:08 forensicmatt

This is also an issue in the extractAll function

forensicmatt avatar Aug 20 '19 18:08 forensicmatt

To fix it, the line:

printVolumeInfo(file, volume)

must be replaced by:

printVolumeInfo(container_urn.original_filename, volume)

But there still is a bug and the extraction will fail because the destination file is opened as text file. So the line:

with open(destFile, "w") as destStream:

must be replaced by:

with open(destFile, "wb") as destStream:

gonmator avatar Aug 27 '19 10:08 gonmator