mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-16 16:14:28 -04:00
fix: Overwrite(add command) was using snapshots without timestamps (and in memory), causing issues with some extractors
This commit is contained in:
parent
a36f36866f
commit
30c886d4d4
3 changed files with 3 additions and 1 deletions
|
@ -106,6 +106,7 @@ class Snapshot(models.Model):
|
||||||
if "tags" in info:
|
if "tags" in info:
|
||||||
# TODO: Handle tags
|
# TODO: Handle tags
|
||||||
info.pop("tags")
|
info.pop("tags")
|
||||||
|
info.pop("base_url", None)
|
||||||
return cls(**info)
|
return cls(**info)
|
||||||
|
|
||||||
def get_history(self) -> dict:
|
def get_history(self) -> dict:
|
||||||
|
|
|
@ -114,7 +114,7 @@ def archive_snapshot(snapshot: Model, overwrite: bool=False, methods: Optional[I
|
||||||
# print('{black} X {}{reset}'.format(method_name, **ANSI))
|
# print('{black} X {}{reset}'.format(method_name, **ANSI))
|
||||||
stats['skipped'] += 1
|
stats['skipped'] += 1
|
||||||
except Exception as e:
|
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,
|
method_name,
|
||||||
snapshot.url,
|
snapshot.url,
|
||||||
)) from e
|
)) from e
|
||||||
|
|
|
@ -597,6 +597,7 @@ def add(urls: Union[str, List[str]],
|
||||||
if update_all:
|
if update_all:
|
||||||
archive_snapshots(all_snapshots, overwrite=overwrite, **archive_kwargs)
|
archive_snapshots(all_snapshots, overwrite=overwrite, **archive_kwargs)
|
||||||
elif overwrite:
|
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)
|
archive_snapshots(imported_snapshots, overwrite=True, **archive_kwargs)
|
||||||
elif new_snapshots:
|
elif new_snapshots:
|
||||||
archive_snapshots(new_snapshots, overwrite=False, **archive_kwargs)
|
archive_snapshots(new_snapshots, overwrite=False, **archive_kwargs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue