1
0
Fork 0
mirror of synced 2024-06-24 00:50:23 +12:00

fix: Overwrite(add command) was using snapshots without timestamps (and in memory), causing issues with some extractors

This commit is contained in:
Cristian 2021-01-16 14:11:45 -05:00
parent a36f36866f
commit 30c886d4d4
3 changed files with 3 additions and 1 deletions

View file

@ -106,6 +106,7 @@ class Snapshot(models.Model):
if "tags" in info:
# TODO: Handle tags
info.pop("tags")
info.pop("base_url", None)
return cls(**info)
def get_history(self) -> dict:

View file

@ -114,7 +114,7 @@ def archive_snapshot(snapshot: Model, overwrite: bool=False, methods: Optional[I
# print('{black} X {}{reset}'.format(method_name, **ANSI))
stats['skipped'] += 1
except Exception as e:
raise Exception('Exception in archive_methods.save_{}(Link(url={}))'.format(
raise Exception('Exception in archive_methods.save_{}(Snapshot(url={}))'.format(
method_name,
snapshot.url,
)) from e

View file

@ -597,6 +597,7 @@ def add(urls: Union[str, List[str]],
if update_all:
archive_snapshots(all_snapshots, overwrite=overwrite, **archive_kwargs)
elif overwrite:
imported_snapshots = Snapshot.objects.filter(url__in=[imported_snapshot.url for imported_snapshot in imported_snapshots])
archive_snapshots(imported_snapshots, overwrite=True, **archive_kwargs)
elif new_snapshots:
archive_snapshots(new_snapshots, overwrite=False, **archive_kwargs)