mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-12 22:25:44 -04:00
fix files icons escaping
This commit is contained in:
parent
39ec77e46c
commit
f0040580c8
1 changed files with 4 additions and 4 deletions
|
@ -4,7 +4,7 @@ from datetime import datetime
|
||||||
from typing import List, Optional, Iterator, Mapping
|
from typing import List, Optional, Iterator, Mapping
|
||||||
from pathlib import Path
|
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 collections import defaultdict
|
||||||
|
|
||||||
from .schema import Link
|
from .schema import Link
|
||||||
|
@ -147,12 +147,12 @@ 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 = 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, "?"))
|
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"))
|
||||||
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":
|
if extractor == "archive_org":
|
||||||
# The check for archive_org is different, so it has to be handled separately
|
# The check for archive_org is different, so it has to be handled separately
|
||||||
|
@ -161,4 +161,4 @@ def snapshot_icons(snapshot) -> str:
|
||||||
output += '<a href="{}" class="exists-{}" title="{}">{}</a> '.format(canon["archive_org_path"], str(exists),
|
output += '<a href="{}" class="exists-{}" title="{}">{}</a> '.format(canon["archive_org_path"], str(exists),
|
||||||
"archive_org", icons.get("archive_org", "?"))
|
"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))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue