p-image: Fix inline style not compliant with Strict CSP policy #15993
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
When using the p-image component, there is a hardcoded inline style using style attribute.
If the project is using Strict Content-Security-Policy, this leads to an error.
Environment
.
Reproducer
No response
Angular version
17.3.10
PrimeNG version
17.18.3
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
v20.5.1
Browser(s)
No response
Steps to reproduce the behavior
Note that
writeDirectStyle()
is a function from Angular Core that set thestyle
attribute to an HTML element.Right after the following breakpoint is when the error is raised:
![image](https://private-user-images.githubusercontent.com/36110804/347347467-6f648fc5-bdf8-4ae9-aa4f-4c2092b11cb7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzMTU3MTEsIm5iZiI6MTczOTMxNTQxMSwicGF0aCI6Ii8zNjExMDgwNC8zNDczNDc0NjctNmY2NDhmYzUtYmRmOC00YWU5LWFhNGYtNGMyMDkyYjExY2I3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDIzMTAxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIxN2VlNDY0NmU0NDhkZWM4MGM5NDhlZWRmZDBmNWI2NDcxY2QwMTZiMGNjMjk5ZTg4Y2U3M2VhMjVmNDZkMDYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.43_bhC1JucQErOwtQCnah6-k-ZwIZ-qLjCSztatc-Hw)
Solution
Move the hardcoded style to
![image](https://private-user-images.githubusercontent.com/36110804/347346163-a04fa173-768c-450f-ba46-fb970f3add6b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzMTU3MTEsIm5iZiI6MTczOTMxNTQxMSwicGF0aCI6Ii8zNjExMDgwNC8zNDczNDYxNjMtYTA0ZmExNzMtNzY4Yy00NTBmLWJhNDYtZmI5NzBmM2FkZDZiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDIzMTAxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM0MTg5Mzg5NzA3MjE4NTEzNDI0ZDhhNWY3NTczYmIzYTI5NzJiNTcxZjFkN2FjNDUxOTI0MDRlYjUwNmZlYWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.u-MZl8aT_QYk_dfT85FqptOByhS0lOTbX-FIZOuse4Y)
ngStyle
attribute, in the same component (image.ts).Expected behavior
No response
The text was updated successfully, but these errors were encountered: