Browse Source

fix ArchiveResult.output_summary admin formatting

Nick Sweeting 1 year ago
parent
commit
d18418cc22
1 changed files with 9 additions and 3 deletions
  1. 9 3
      archivebox/core/admin.py

+ 9 - 3
archivebox/core/admin.py

@@ -700,18 +700,24 @@ class ArchiveResultAdmin(ABIDModelAdmin):
     def output_summary(self, result):
     def output_summary(self, result):
         snapshot_dir = Path(CONFIG.OUTPUT_DIR) / str(result.pwd).split('data/', 1)[-1]
         snapshot_dir = Path(CONFIG.OUTPUT_DIR) / str(result.pwd).split('data/', 1)[-1]
         output_str = format_html(
         output_str = format_html(
-            '<pre style="display: inline-block">{}</pre><br/>',
+            '<pre style="display: block; max-width: 75vw; white-space: pre-line;">{}</pre><br/>',
             result.output,
             result.output,
         )
         )
         output_str += format_html('<a href="/archive/{}/index.html#all">See result files ...</a><br/><pre><code>', str(result.snapshot.timestamp))
         output_str += format_html('<a href="/archive/{}/index.html#all">See result files ...</a><br/><pre><code>', str(result.snapshot.timestamp))
         path_from_output_str = (snapshot_dir / result.output)
         path_from_output_str = (snapshot_dir / result.output)
         output_str += format_html('<i style="padding: 1px">{}</i><b style="padding-right: 20px">/</b><i>{}</i><br/><hr/>', str(snapshot_dir), str(result.output))
         output_str += format_html('<i style="padding: 1px">{}</i><b style="padding-right: 20px">/</b><i>{}</i><br/><hr/>', str(snapshot_dir), str(result.output))
-        if path_from_output_str.exists():
+        
+        path_exists = False
+        try:
+            path_exists = path_from_output_str.exists()
+        except OSError:
+            pass
+
+        if path_exists:
             root_dir = str(path_from_output_str)
             root_dir = str(path_from_output_str)
         else:
         else:
             root_dir = str(snapshot_dir)
             root_dir = str(snapshot_dir)
 
 
-
         # print(root_dir, str(list(os.walk(root_dir))))
         # print(root_dir, str(list(os.walk(root_dir))))
 
 
         for root, dirs, files in os.walk(root_dir):
         for root, dirs, files in os.walk(root_dir):