Skip to content

Commit 8251f77

Browse files
committed
Handle unintended h2 element formatting
1 parent a67034e commit 8251f77

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

hypha/apply/funds/views/revisions.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,12 @@ def cleanse_stream_fields(self, a_field, b_field) -> List[str]:
159159
field,
160160
)
161161
try:
162-
heading = field_match.group(1)
162+
# Keep h2 tags but purge any classes/attributes
163+
heading = nh3.clean(field_match.group(1), tags={"h2"}, attributes={})
164+
165+
# Handle lists on the answer fields by subbing HTML for chars
163166
answer = re.sub("(<li[^>]*>)", r"\1◦ ", field_match.group(2))
167+
# Cleanse answer of HTML
164168
answer = nh3.clean(answer, attributes={}, tags=set())
165169

166170
sanitized_answers.append(f"{heading}{answer}")

0 commit comments

Comments
 (0)