1
0
Fork 0

fix: Add condition for oneshot when archiving links

This commit is contained in:
Cristian 2020-11-04 14:40:44 -05:00
parent 4484491fb7
commit f292cface2

View file

@ -66,8 +66,9 @@ def archive_link(link: Link, overwrite: bool=False, methods: Optional[Iterable[s
"""download the DOM, PDF, and a screenshot into a folder named after the link's timestamp"""
# TODO: Remove when the input is changed to be a snapshot. Suboptimal approach.
from core.models import Snapshot, ArchiveResult
snapshot = Snapshot.objects.get(url=link.url)
if not skip_index:
from core.models import Snapshot, ArchiveResult
snapshot = Snapshot.objects.get(url=link.url)
ARCHIVE_METHODS = get_default_archive_methods()
@ -103,7 +104,8 @@ def archive_link(link: Link, overwrite: bool=False, methods: Optional[Iterable[s
stats[result.status] += 1
log_archive_method_finished(result)
ArchiveResult.objects.create(snapshot=snapshot, extractor=method_name, cmd=result.cmd, cmd_version=result.cmd_version,
if not skip_index:
ArchiveResult.objects.create(snapshot=snapshot, extractor=method_name, cmd=result.cmd, cmd_version=result.cmd_version,
output=result.output, pwd=result.pwd, start_ts=result.start_ts, end_ts=result.end_ts, status=result.status)
else: