Skip to content

Commit

Permalink
fix files icons escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
pirate committed Jan 29, 2021
1 parent 39ec77e commit f004058
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions archivebox/index/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import List, Optional, Iterator, Mapping
from pathlib import Path

from django.utils.html import format_html
from django.utils.html import format_html, mark_safe
from collections import defaultdict

from .schema import Link
Expand Down Expand Up @@ -147,12 +147,12 @@ def snapshot_icons(snapshot) -> str:
for extractor, _ in EXTRACTORS:
if extractor not in exclude:
exists = extractor_items[extractor] is not None
output += output_template.format(path, canon[f"{extractor}_path"], str(exists),
output += format_html(output_template, path, canon[f"{extractor}_path"], str(exists),
extractor, icons.get(extractor, "?"))
if extractor == "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"))
output += output_template.format(exists[0] if exists else '#', canon["warc_path"], str(bool(exists)), "warc", icons.get("warc", "?"))
output += format_html(output_template, exists[0] if exists else '#', canon["warc_path"], str(bool(exists)), "warc", icons.get("warc", "?"))

if extractor == "archive_org":
# The check for archive_org is different, so it has to be handled separately
Expand All @@ -161,4 +161,4 @@ def snapshot_icons(snapshot) -> str:
output += '<a href="{}" class="exists-{}" title="{}">{}</a> '.format(canon["archive_org_path"], str(exists),
"archive_org", icons.get("archive_org", "?"))

return format_html('<span class="files-icons" style="font-size: 1.1em; opacity: 0.8">{}<span>', output)
return format_html('<span class="files-icons" style="font-size: 1.1em; opacity: 0.8">{}<span>', mark_safe(output))

0 comments on commit f004058

Please sign in to comment.