Browse Source

fix icons in public index

Nick Sweeting 4 năm trước cách đây
mục cha
commit
cc80ceb0a2
1 tập tin đã thay đổi với 8 bổ sung2 xóa
  1. 8 2
      archivebox/index/html.py

+ 8 - 2
archivebox/index/html.py

@@ -146,9 +146,15 @@ def snapshot_icons(snapshot) -> str:
 
 
     for extractor, _ in EXTRACTORS:
     for extractor, _ in EXTRACTORS:
         if extractor not in exclude:
         if extractor not in exclude:
-            exists = extractor_items[extractor] is not None
+            exists = False
+            if extractor_items[extractor] is not None:
+                outpath = (Path(path) / canon[f"{extractor}_path"])
+                if outpath.is_dir():
+                    exists = any(outpath.glob('*.*'))
+                elif outpath.is_file():
+                    exists = outpath.stat().st_size > 100
             output += format_html(output_template, path, canon[f"{extractor}_path"], str(exists),
             output += format_html(output_template, path, canon[f"{extractor}_path"], str(exists),
-                                             extractor, icons.get(extractor, "?"))
+                                         extractor, icons.get(extractor, "?"))
         if extractor == "wget":
         if extractor == "wget":
             # warc isn't technically it's own extractor, so we have to add it after wget
             # warc isn't technically it's own extractor, so we have to add it after wget
             exists = list((Path(path) / canon["warc_path"]).glob("*.warc.gz"))
             exists = list((Path(path) / canon["warc_path"]).glob("*.warc.gz"))