Skip to content

Commit f416d7f

Browse files
fix(bleach-to-nh3): replace bleach with nh3 in api_sonarqube importer
Missed file in initial bleach→nh3 migration. Maps bleach.clean() params to nh3.clean() equivalents: protocols→url_schemes, lists→sets. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ec2a0f6 commit f416d7f

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

dojo/tools/api_sonarqube/importer.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import re
33
import textwrap
44

5-
import bleach
65
import html2text
76
import markdown
7+
import nh3
88
from django.conf import settings
99
from django.core.exceptions import ValidationError
1010
from lxml import etree
@@ -420,12 +420,11 @@ def sanitize_rule_details(description):
420420
description,
421421
flags=re.DOTALL | re.IGNORECASE,
422422
)
423-
return bleach.clean(
423+
return nh3.clean(
424424
sanitized_description,
425-
tags=SonarQubeApiImporter.ALLOWED_RULE_DESCRIPTION_TAGS,
426-
attributes=SonarQubeApiImporter.ALLOWED_RULE_DESCRIPTION_ATTRIBUTES,
427-
protocols=SonarQubeApiImporter.ALLOWED_RULE_DESCRIPTION_PROTOCOLS,
428-
strip=True,
425+
tags=set(SonarQubeApiImporter.ALLOWED_RULE_DESCRIPTION_TAGS),
426+
attributes={k: set(v) for k, v in SonarQubeApiImporter.ALLOWED_RULE_DESCRIPTION_ATTRIBUTES.items()},
427+
url_schemes=set(SonarQubeApiImporter.ALLOWED_RULE_DESCRIPTION_PROTOCOLS),
429428
)
430429

431430
@staticmethod

0 commit comments

Comments
 (0)