Skip to content

Commit

Permalink
Fixed modal window link issue when moduleName has special character
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun Ananth committed Jan 26, 2022
1 parent 95d37ee commit 1e0f070
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/lib/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,9 @@ Handlebars.registerHelper(
'severityNumber',
(severity: string) => severityMap[severity]?.number
)

Handlebars.registerHelper(
'nameHandler',
(input) => {
return input.replace('@',"").replace('/',"-")
})
8 changes: 4 additions & 4 deletions templates/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
class="badge badge-{{severityClass severity}}">{{severity}}</span></td>
<td>
<a href="{{url}}" data-toggle="modal"
data-target="#advisory-modal-{{name}}">{{via.length}}</a>
data-target="#advisory-modal-{{nameHandler name}}">{{via.length}}</a>
</td>
</tr>
{{/each}}
Expand All @@ -220,7 +220,7 @@


{{#each vulnerabilities}}
<div class="modal" tabindex="-1" role="dialog" id="advisory-modal-{{name}}">
<div class="modal" tabindex="-1" role="dialog" id="advisory-modal-{{nameHandler name}}">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
Expand All @@ -242,7 +242,7 @@
</li>
{{else}}
<li>
<a href="{{url}}" data-toggle="modal" data-target="#advisory-modal-{{this}}"
<a href="{{url}}" data-toggle="modal" data-target="#advisory-modal-{{nameHandler this}}"
data-dismiss="modal">{{this}}</a>
</li>
{{/if}}
Expand Down Expand Up @@ -276,4 +276,4 @@
</script>
</body>

</html>
</html>

0 comments on commit 1e0f070

Please sign in to comment.