Sfoglia il codice sorgente

pass overwrite properly

Nick Sweeting 5 anni fa
parent
commit
943453a9a8
3 ha cambiato i file con 5 aggiunte e 4 eliminazioni
  1. 2 1
      archivebox/core/views.py
  2. 2 2
      archivebox/extractors/__init__.py
  3. 1 1
      archivebox/main.py

+ 2 - 1
archivebox/core/views.py

@@ -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:

+ 2 - 2
archivebox/extractors/__init__.py

@@ -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)

+ 1 - 1
archivebox/main.py

@@ -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)