Skip to content

Commit

Permalink
show malcolm columns if malcolm redirect header is in place (idaholab…
Browse files Browse the repository at this point in the history
  • Loading branch information
mmguero committed Apr 2, 2024
1 parent fdf0afc commit bebe677
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions shared/bin/extracted_files_http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ def do_GET(self):
global debug
global args

showMalcolmCols = args.malcolm or (malcolm_forward_header in dict(self.headers))
assetsDirRespReplacer = f"{str(dict(self.headers).get(malcolm_forward_header, ''))}{args.assetsDirRespReplacer}"

fullpath, relpath = self.translate_path(self.path)
fileBaseName = os.path.basename(fullpath)
fnameDispLen = filename_truncate_len_malcolm if args.malcolm else filename_truncate_len
fnameDispLen = filename_truncate_len_malcolm if showMalcolmCols else filename_truncate_len

tomorrowStr = (datetime.now(UTC) + timedelta(days=1)).isoformat().split('.')[0]

Expand Down Expand Up @@ -138,7 +139,7 @@ def do_GET(self):
th("Type" if args.magic else "Extension"),
th("Size"),
)
if args.malcolm:
if showMalcolmCols:
t.add(
th("Source"),
th("IDs"),
Expand All @@ -151,7 +152,7 @@ def do_GET(self):
td("Directory"),
td(''),
)
if args.malcolm:
if showMalcolmCols:
t.add(th(), th(), th())

# content rows (files and directories)
Expand All @@ -167,7 +168,7 @@ def do_GET(self):
td("Directory"),
td(''),
)
if args.malcolm:
if showMalcolmCols:
t.add(th(), th(), th())
except Exception as e:
eprint(f'Error with directory "{dirname}"": {e}')
Expand All @@ -186,7 +187,7 @@ def do_GET(self):
fmatch = None
fsource = ''
fids = list()
if args.malcolm:
if showMalcolmCols:
# determine if filename is in a pattern we recognize
fmatch = carvedFileRegex.search(filename)
if fmatch is None:
Expand Down Expand Up @@ -260,7 +261,7 @@ def do_GET(self):
)

# show special malcolm columns if requested
if args.malcolm:
if showMalcolmCols:
if fmatch is not None:
# list carve source, IDs, and timestamp
t.add(
Expand Down Expand Up @@ -308,7 +309,7 @@ def do_GET(self):
)

with div(cls="col-lg-6 h-100 text-center text-lg-end my-auto").add(ul(cls="list-inline mb-0")):
if args.malcolm:
if showMalcolmCols:
li(cls="list-inline-item").add(a(href=f'/', target="_blank")).add(
i(cls="bi bi-house fs-3", title="Malcolm")
)
Expand Down

0 comments on commit bebe677

Please sign in to comment.