[mirotalk] - fix decodeURIComponent
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@ dependencies: {
|
||||
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
|
||||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
|
||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||
* @version 1.4.83
|
||||
* @version 1.4.84
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
+10
-2
@@ -71,11 +71,19 @@ function needsDecoding(str) {
|
||||
return urlEncodedPattern.test(str);
|
||||
}
|
||||
|
||||
// Recursively sanitize data based on its type
|
||||
function safeDecodeURIComponent(str) {
|
||||
try {
|
||||
return decodeURIComponent(str);
|
||||
} catch (e) {
|
||||
log.error('Malformed URI component detected:', str);
|
||||
return str; // Return original string if decoding fails
|
||||
}
|
||||
}
|
||||
|
||||
function sanitizeData(data) {
|
||||
if (typeof data === 'string') {
|
||||
// Decode HTML entities and URL encoded content
|
||||
const decodedData = needsDecoding(data) ? he.decode(decodeURIComponent(data)) : he.decode(data);
|
||||
const decodedData = needsDecoding(data) ? he.decode(safeDecodeURIComponent(data)) : he.decode(data);
|
||||
return purify.sanitize(decodedData);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user