mirror of https://github.com/CIRCL/PyCIRCLean
Fix issue with hashing symlinks to directories
parent
3eff10fbcd
commit
cc5d1e5117
|
@ -251,7 +251,7 @@ class File(FileBase):
|
||||||
props = self.get_all_props()
|
props = self.get_all_props()
|
||||||
if not self.is_archive:
|
if not self.is_archive:
|
||||||
if os.path.exists(self.tempdir_path):
|
if os.path.exists(self.tempdir_path):
|
||||||
# FIXME: Hack to make images appear at the correct tree depth in log
|
# FIXME: in_tempdir is a hack to make images appear at the correct tree depth in log
|
||||||
self.logger.add_file(self.src_path, props, in_tempdir=True)
|
self.logger.add_file(self.src_path, props, in_tempdir=True)
|
||||||
return
|
return
|
||||||
self.logger.add_file(self.src_path, props)
|
self.logger.add_file(self.src_path, props)
|
||||||
|
@ -588,7 +588,10 @@ class GroomerLogger(object):
|
||||||
def add_file(self, file_path, file_props, in_tempdir=False):
|
def add_file(self, file_path, file_props, in_tempdir=False):
|
||||||
"""Add a file to the log. Takes a path and a dict of file properties."""
|
"""Add a file to the log. Takes a path and a dict of file properties."""
|
||||||
depth = self._get_path_depth(file_path)
|
depth = self._get_path_depth(file_path)
|
||||||
|
try:
|
||||||
file_hash = Logging.computehash(file_path)[:6]
|
file_hash = Logging.computehash(file_path)[:6]
|
||||||
|
except IsADirectoryError:
|
||||||
|
file_hash = 'directory'
|
||||||
if file_props['is_symlink']:
|
if file_props['is_symlink']:
|
||||||
symlink_template = "+- NOT COPIED: symbolic link to {name} ({sha_hash})"
|
symlink_template = "+- NOT COPIED: symbolic link to {name} ({sha_hash})"
|
||||||
log_string = symlink_template.format(
|
log_string = symlink_template.format(
|
||||||
|
|
Loading…
Reference in New Issue