mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-10 14:44:18 +00:00
pass overwrite properly
This commit is contained in:
parent
d6030e15c7
commit
943453a9a8
3 changed files with 5 additions and 4 deletions
|
@ -72,7 +72,8 @@ class LinkDetails(View):
|
|||
# slug is a timestamp
|
||||
by_ts = {page.timestamp: page for page in all_pages}
|
||||
try:
|
||||
response = static.serve(request, archivefile, by_ts[slug].link_dir, show_indexes=True)
|
||||
# print('SERVING STATICFILE', by_ts[slug].link_dir, request.path, path)
|
||||
response = static.serve(request, archivefile, document_root=by_ts[slug].link_dir, show_indexes=True)
|
||||
response["Link"] = f'<{by_ts[slug].url}>; rel="canonical"'
|
||||
return response
|
||||
except KeyError:
|
||||
|
|
|
@ -110,7 +110,7 @@ def archive_link(link: Link, overwrite: bool=False, out_dir: Optional[str]=None)
|
|||
|
||||
|
||||
@enforce_types
|
||||
def archive_links(links: List[Link], out_dir: Optional[str]=None) -> List[Link]:
|
||||
def archive_links(links: List[Link], overwrite: bool=False, methods: Optional[Iterable[str]]=None, out_dir: Optional[str]=None) -> List[Link]:
|
||||
if not links:
|
||||
return []
|
||||
|
||||
|
@ -119,7 +119,7 @@ def archive_links(links: List[Link], out_dir: Optional[str]=None) -> List[Link]:
|
|||
link: Link = links[0]
|
||||
try:
|
||||
for idx, link in enumerate(links):
|
||||
archive_link(link, out_dir=link.link_dir)
|
||||
archive_link(link, overwrite=overwrite, methods=methods, out_dir=link.link_dir)
|
||||
except KeyboardInterrupt:
|
||||
log_archiving_paused(len(links), idx, link.timestamp)
|
||||
raise SystemExit(0)
|
||||
|
|
|
@ -673,7 +673,7 @@ def update(resume: Optional[float]=None,
|
|||
|
||||
# Step 3: Run the archive methods for each link
|
||||
to_archive = new_links if only_new else all_links
|
||||
archive_links(to_archive, out_dir=out_dir)
|
||||
archive_links(to_archive, overwrite=overwrite, out_dir=out_dir)
|
||||
|
||||
# Step 4: Re-write links index with updated titles, icons, and resources
|
||||
all_links = load_main_index(out_dir=out_dir)
|
||||
|
|
Loading…
Reference in a new issue