Applying Scott Bassin's fix and test from LANG-363
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@588534 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ed7e9b4349
commit
c22d9d59e5
|
@ -233,6 +233,10 @@ public class StringEscapeUtils {
|
|||
out.write('\\');
|
||||
out.write('\\');
|
||||
break;
|
||||
case '/':
|
||||
out.write('\\');
|
||||
out.write('/');
|
||||
break;
|
||||
default :
|
||||
out.write(ch);
|
||||
break;
|
||||
|
|
|
@ -184,6 +184,8 @@ public class StringEscapeUtilsTest extends TestCase {
|
|||
}
|
||||
|
||||
assertEquals("He didn\\'t say, \\\"stop!\\\"", StringEscapeUtils.escapeJavaScript("He didn't say, \"stop!\""));
|
||||
assertEquals("document.getElementById(\\\"test\\\").value = \\'<script>alert(\\'aaa\\');<\\/script>\\';",
|
||||
StringEscapeUtils.escapeJavaScript("document.getElementById(\"test\").value = '<script>alert('aaa');</script>';"));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue