mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-28 13:44:14 -04: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
|
# slug is a timestamp
|
||||||
by_ts = {page.timestamp: page for page in all_pages}
|
by_ts = {page.timestamp: page for page in all_pages}
|
||||||
try:
|
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"'
|
response["Link"] = f'<{by_ts[slug].url}>; rel="canonical"'
|
||||||
return response
|
return response
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
|
@ -110,7 +110,7 @@ def archive_link(link: Link, overwrite: bool=False, out_dir: Optional[str]=None)
|
||||||
|
|
||||||
|
|
||||||
@enforce_types
|
@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:
|
if not links:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ def archive_links(links: List[Link], out_dir: Optional[str]=None) -> List[Link]:
|
||||||
link: Link = links[0]
|
link: Link = links[0]
|
||||||
try:
|
try:
|
||||||
for idx, link in enumerate(links):
|
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:
|
except KeyboardInterrupt:
|
||||||
log_archiving_paused(len(links), idx, link.timestamp)
|
log_archiving_paused(len(links), idx, link.timestamp)
|
||||||
raise SystemExit(0)
|
raise SystemExit(0)
|
||||||
|
|
|
@ -673,7 +673,7 @@ def update(resume: Optional[float]=None,
|
||||||
|
|
||||||
# Step 3: Run the archive methods for each link
|
# Step 3: Run the archive methods for each link
|
||||||
to_archive = new_links if only_new else all_links
|
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
|
# Step 4: Re-write links index with updated titles, icons, and resources
|
||||||
all_links = load_main_index(out_dir=out_dir)
|
all_links = load_main_index(out_dir=out_dir)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue