mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-22 17:44:52 +02:00
Update the output filename (preferred_filename) so that we can notify it correctly to the user
This commit is contained in:
@@ -789,8 +789,16 @@ class CommandLine:
|
||||
if self._file.closed:
|
||||
return None
|
||||
|
||||
self._file.close()
|
||||
output_filename = self._get_final_filename()
|
||||
|
||||
# Update the filename, which may have changed if a file with
|
||||
# the same name already existed. This needs to be done before
|
||||
# closing the file, otherwise FileHandlerInterface will raise
|
||||
# an exception. Also, the preferred_filename setter only allows
|
||||
# a specific set of characters, where '/' is not in that list
|
||||
self.preferred_filename = os.path.basename(output_filename)
|
||||
|
||||
self._file.close()
|
||||
os.rename(self._name, output_filename)
|
||||
|
||||
if direct:
|
||||
|
||||
@@ -115,6 +115,10 @@ class LayerWriter(plugins.PluginInterface):
|
||||
progress_callback=self._progress_callback,
|
||||
)
|
||||
file_handle.close()
|
||||
|
||||
# Update the filename, which may have changed if a file
|
||||
# with the same name already existed.
|
||||
output_name = file_handle.preferred_filename
|
||||
except IOError as excp:
|
||||
yield 0, (f"Layer cannot be written to {output_name}: {excp}",)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user