File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1+ import DOMPurify from 'dompurify' ;
2+
13//Detect Faces
24async function detectFaces ( data ) {
35 const existingElement = document . querySelector ( '[data-role="dynamic-image"]' ) || document . querySelector ( 'video[data-role="dynamic-video"]' ) || document . querySelector ( '[data-role="dynamic-dragged"]' ) ;
@@ -23,7 +25,8 @@ async function detectFaces(data) {
2325 img . style . maxHeight = '500px' ;
2426 img . setAttribute ( 'data-role' , 'dynamic-image' ) ;
2527
26- const imgSrc = imagedir + data ;
28+ const sanitizedData = DOMPurify . sanitize ( data ) ;
29+ const imgSrc = imagedir + sanitizedData ;
2730 img . src = imgSrc ;
2831
2932 // Check if the image source is valid
@@ -75,7 +78,8 @@ async function detectEmotion(data) {
7578 img . style . maxHeight = '500px' ;
7679 img . setAttribute ( 'data-role' , 'dynamic-image' ) ;
7780
78- const imgSrc = imagedir + data ;
81+ const sanitizedData = DOMPurify . sanitize ( data ) ;
82+ const imgSrc = imagedir + sanitizedData ;
7983 img . src = imgSrc ;
8084
8185 // Check if the image source is valid
You can’t perform that action at this time.
0 commit comments