mirror of https://github.com/CIRCL/lookyloo
fix: unlink indexes pointing to unknown directories
parent
4c4b01547a
commit
2e5a5f3aff
|
@ -116,14 +116,20 @@ class Archiver(AbstractManager):
|
||||||
# Initialize archives
|
# Initialize archives
|
||||||
for index in get_captures_dir().glob('**/index'):
|
for index in get_captures_dir().glob('**/index'):
|
||||||
with index.open('r') as _f:
|
with index.open('r') as _f:
|
||||||
recent_uuids: Dict[str, str] = {uuid: str(index.parent / dirname) for uuid, dirname in csv.reader(_f)}
|
recent_uuids: Dict[str, str] = {uuid: str(index.parent / dirname) for uuid, dirname in csv.reader(_f) if (index.parent / dirname).exists()}
|
||||||
self.redis.hmset('lookup_dirs', recent_uuids) # type: ignore
|
if recent_uuids:
|
||||||
|
self.redis.hmset('lookup_dirs', recent_uuids) # type: ignore
|
||||||
|
else:
|
||||||
|
index.unlink()
|
||||||
|
|
||||||
# Initialize archives
|
# Initialize archives
|
||||||
for index in self.archived_captures_dir.glob('**/index'):
|
for index in self.archived_captures_dir.glob('**/index'):
|
||||||
with index.open('r') as _f:
|
with index.open('r') as _f:
|
||||||
archived_uuids: Dict[str, str] = {uuid: str(index.parent / dirname) for uuid, dirname in csv.reader(_f)}
|
archived_uuids: Dict[str, str] = {uuid: str(index.parent / dirname) for uuid, dirname in csv.reader(_f) if (index.parent / dirname).exists()}
|
||||||
self.redis.hmset('lookup_dirs_archived', archived_uuids) # type: ignore
|
if archived_uuids:
|
||||||
|
self.redis.hmset('lookup_dirs_archived', archived_uuids) # type: ignore
|
||||||
|
else:
|
||||||
|
index.unlink()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
Loading…
Reference in New Issue