Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/org/owasp/html/HtmlEntities.java
Original file line number Diff line number Diff line change
Expand Up @@ -2232,6 +2232,7 @@ public static int appendDecodedEntity(
case 'y': case 'z':
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
case '-': case '_':
break;
case '=':
// An equal sign after an entity missing a closing semicolon should
Expand Down
24 changes: 24 additions & 0 deletions src/test/java/org/owasp/html/HtmlEntitiesTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.owasp.html;

import org.junit.Test;

import junit.framework.TestCase;

@SuppressWarnings("javadoc")
public class HtmlEntitiesTest extends TestCase {

@Test
public void testAfterAmpString() {
String input = "<a href=\"/t?a=1&order_id=2\">order</a>";
String output = Encoding.decodeHtml(input);
assertEquals("<a href=\"/t?a=1&order_id=2\">order</a>", output);

input = "<a href=\"/t?a=1&order-id=2\">order</a>";
output = Encoding.decodeHtml(input);
assertEquals("<a href=\"/t?a=1&order-id=2\">order</a>", output);

input = "<a href=\"/t?a=1&order=2\">order</a>";
output = Encoding.decodeHtml(input);
assertEquals("<a href=\"/t?a=1&order=2\">order</a>", output);
}
}