We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d2d2e77 commit 02f2be6Copy full SHA for 02f2be6
lib/xss.js
@@ -64,7 +64,12 @@ exports.clean = function(str, is_image) {
64
65
//Decode just in case stuff like this is submitted:
66
//<a href="http://%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D">Google</a>
67
- str = decodeURIComponent(str);
+ try{
68
+ str = decodeURIComponent(str);
69
+ }
70
+ catch(error){
71
+ // str was not actually URI-encoded
72
73
74
//Convert character entities to ASCII - this permits our tests below to work reliably.
75
//We only convert entities that are within tags since these are the ones that will pose security problems.
0 commit comments