diff --git a/packages/angular/build/src/utils/index-file/nonce.ts b/packages/angular/build/src/utils/index-file/nonce.ts index ad4e01a723c9..d21f8b6900e5 100644 --- a/packages/angular/build/src/utils/index-file/nonce.ts +++ b/packages/angular/build/src/utils/index-file/nonce.ts @@ -29,8 +29,7 @@ export async function addNonce(html: string): Promise { rewriter.on('startTag', (tag) => { if ( - (tag.tagName === 'style' || - (tag.tagName === 'script' && !tag.attrs.some((attr) => attr.name === 'src'))) && + (tag.tagName === 'style' || tag.tagName === 'script') && !tag.attrs.some((attr) => attr.name === 'nonce') ) { tag.attrs.push({ name: 'nonce', value: nonce }); diff --git a/packages/angular/build/src/utils/index-file/nonce_spec.ts b/packages/angular/build/src/utils/index-file/nonce_spec.ts index cafd4bae623e..7b874828ece4 100644 --- a/packages/angular/build/src/utils/index-file/nonce_spec.ts +++ b/packages/angular/build/src/utils/index-file/nonce_spec.ts @@ -74,22 +74,22 @@ describe('addNonce', () => { expect(result).toContain(''); }); - it('should to all inline script tags', async () => { + it('should to all script tags', async () => { const result = await addNonce(` - - `); - expect(result).toContain(`'); - expect(result).toContain(``); + expect(result).toContain(''); + expect(result).toContain(``); }); });