Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update backend/scanners_core.py
Browse files- backend/scanners_core.py +3 -1
backend/scanners_core.py
CHANGED
|
@@ -1778,13 +1778,15 @@ def generate_scan_pdf(scan, vulnerabilities):
|
|
| 1778 |
elements.append(Paragraph(f"<b>Remediation (Finding #{idx}):</b>", styles['Normal']))
|
| 1779 |
rem_text_raw = vuln.remediation or "No specific remediation step provided. Follow standard secure coding practices."
|
| 1780 |
|
| 1781 |
-
|
|
|
|
| 1782 |
if not raw_sentences:
|
| 1783 |
raw_sentences = [rem_text_raw]
|
| 1784 |
|
| 1785 |
numbered_rem_html = []
|
| 1786 |
step_counter = 1
|
| 1787 |
for sent in raw_sentences:
|
|
|
|
| 1788 |
clean_sent = re.sub(r'^[0-9]+\.\s*|^[-*•]\s*', '', sent).strip()
|
| 1789 |
if clean_sent:
|
| 1790 |
if not clean_sent.endswith('.'):
|
|
|
|
| 1778 |
elements.append(Paragraph(f"<b>Remediation (Finding #{idx}):</b>", styles['Normal']))
|
| 1779 |
rem_text_raw = vuln.remediation or "No specific remediation step provided. Follow standard secure coding practices."
|
| 1780 |
|
| 1781 |
+
# Split ONLY on newlines — do NOT split on '. ' to avoid breaking numbered steps like '1. Generate DNSSEC keys'
|
| 1782 |
+
raw_sentences = [s.strip() for s in rem_text_raw.split('\n') if s.strip()]
|
| 1783 |
if not raw_sentences:
|
| 1784 |
raw_sentences = [rem_text_raw]
|
| 1785 |
|
| 1786 |
numbered_rem_html = []
|
| 1787 |
step_counter = 1
|
| 1788 |
for sent in raw_sentences:
|
| 1789 |
+
# Strip leading number markers like '1.' '2.' '-' '*' '•'
|
| 1790 |
clean_sent = re.sub(r'^[0-9]+\.\s*|^[-*•]\s*', '', sent).strip()
|
| 1791 |
if clean_sent:
|
| 1792 |
if not clean_sent.endswith('.'):
|