Skip to content

Commit d19c014

Browse files
committed
fixup! feat(@angular/build): add CSP nonce to stylesheet and modulepreload link elements
1 parent f415168 commit d19c014

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • packages/angular/build/src/utils/index-file

‎packages/angular/build/src/utils/index-file/nonce.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ export async function addNonce(html: string): Promise<string> {
3737
for (const attr of attrs) {
3838
if (attr.name === 'nonce') {
3939
hasNonce = true;
40-
} else if (tagName === 'link' && attr.name === 'rel' && attr.value) {
40+
break;
41+
}
42+
43+
if (tagName === 'link' && attr.name === 'rel' && attr.value) {
4144
const tokens = attr.value.trim().split(/\s+/);
4245
if (tokens.includes('stylesheet') || tokens.includes('modulepreload')) {
4346
isTarget = true;

0 commit comments

Comments
 (0)