Skip to content

Commit

Permalink
fix: mark SVG path as sanitized
Browse files Browse the repository at this point in the history
  • Loading branch information
b12f committed Jul 20, 2023
1 parent b47be85 commit 1004d47
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/pretty-bottles-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openproject/octicons': patch
---

fix: mark SVG Path as sanitized
2 changes: 1 addition & 1 deletion lib/octicons_angular/script/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const icons = Object.entries(octicons)
template: \`
<title *ngIf="title">{{title}}</title>
<path [outerHTML]="path"></path>
<path [outerHTML]="sanitizer.bypassSecurityTrustHtml(path)"></path>
\`,
})
export class Op${name} extends OpOcticonComponentBase {
Expand Down
3 changes: 3 additions & 0 deletions lib/octicons_angular/src/octicon-component-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Input,
HostBinding
} from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { closestNaturalHeight } from './helpers';

@Directive({})
Expand Down Expand Up @@ -71,4 +72,6 @@ export class OpOcticonComponentBase {
path: string,
};
} = {};

constructor(protected sanitizer:DomSanitizer) {}
}

0 comments on commit 1004d47

Please sign in to comment.