Skip to content

Commit de4e8be

Browse files
committed
Handle None in UI
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 8cc7c50 commit de4e8be

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

vulnerabilities/templates/advisory_detail.html

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,20 @@
214214
{% for severity in severities %}
215215
<tr>
216216
<td class="wrap-strings">{{ severity.scoring_system }}</td>
217-
<td class="wrap-strings">{{ severity.value }}</td>
218-
<td class="wrap-strings"><a href="{{ severity.url }}" target="_blank">
217+
<td class="wrap-strings">
218+
{% if severity.value is not None %}
219+
{{ severity.value }}
220+
{% else %}
221+
{{ "" }}
222+
{% endif %}
223+
</td>
224+
<td class="wrap-strings">
225+
{% if severity.url is not None %}
226+
<a href="{{ severity.url }}" target="_blank">
219227
{{ severity.url }}<i class="fa fa-external-link fa_link_custom"></i></a>
228+
{% else %}
229+
{{ "" }}
230+
{% endif %}
220231
</td>
221232
</tr>
222233
{% empty %}
@@ -483,7 +494,11 @@
483494
<div class="tab-div content" data-content="severities-vectors">
484495
{% for severity_vector in severity_vectors %}
485496
{% if severity_vector.vector.version == '2.0' %}
486-
Vector: {{ severity_vector.vector.vectorString }} Found at <a href="{{ severity_vector.origin }}" target="_blank">{{ severity_vector.origin }}</a>
497+
Vector: {{ severity_vector.vector.vectorString }}
498+
{% if severity_vector.origin %}
499+
Found at
500+
<a href="{{ severity_vector.origin }}" target="_blank">{{ severity_vector.origin }}</a>
501+
{% endif %}
487502
<table class="table is-bordered is-striped is-narrow is-hoverable is-fullwidth gray-header-border">
488503
<tr>
489504
<th>Exploitability (E)</th>

vulnerabilities/templates/package_details_v2.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@
118118
Risk score
119119
</td>
120120
<td class="two-col-right">
121+
{% if package.risk_score is not None %}
121122
{{package.risk_score}}
123+
{% else %}
124+
{{""}}
125+
{% endif %}
122126
</td>
123127
</tr>
124128
</tbody>

vulnerabilities/templates/packages_v2.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@
6262
target="_self">{{ package.purl }}</a>
6363
</td>
6464
<td>{{ package.is_vulnerable|yesno:"Yes,No" }}</td>
65-
<td>{{ package.risk_score }}</td>
65+
<td>
66+
{% if package.risk_score is not None %}
67+
{{ package.risk_score }}
68+
{% else %}
69+
{{ "" }}
70+
{% endif %}
71+
</td>
6672
</tr>
6773
{% empty %}
6874
<tr>

0 commit comments

Comments
 (0)