From f0040580c82a8f0d3fc280ebac1fb5baf8949efb Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Thu, 28 Jan 2021 22:27:17 -0500 Subject: [PATCH] fix files icons escaping --- archivebox/index/html.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/archivebox/index/html.py b/archivebox/index/html.py index 12eab62a..0ba8e7c1 100644 --- a/archivebox/index/html.py +++ b/archivebox/index/html.py @@ -4,7 +4,7 @@ from datetime import datetime 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 @@ -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 @@ -161,4 +161,4 @@ def snapshot_icons(snapshot) -> str: output += '{} '.format(canon["archive_org_path"], str(exists), "archive_org", icons.get("archive_org", "?")) - return format_html('{}', output) + return format_html('{}', mark_safe(output))