Skip to content

Commit

Permalink
formData retrieves "input type=image" incorrectly (#2010)
Browse files Browse the repository at this point in the history
Remove input type=image in formData()
  • Loading branch information
ericksonlbs authored Oct 12, 2023
1 parent 0cfc14c commit 144835d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/org/jsoup/nodes/FormElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public List<Connection.KeyVal> formData() {
if (name.length() == 0) continue;
String type = el.attr("type");

if (type.equalsIgnoreCase("button")) continue; // browsers don't submit these
if (type.equalsIgnoreCase("button") || type.equalsIgnoreCase("image")) continue; // browsers don't submit these

if ("select".equals(el.normalName())) {
Elements options = el.select("option[selected]");
Expand Down
1 change: 1 addition & 0 deletions src/test/java/org/jsoup/nodes/FormElementTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public static void setUp() {
"<input name='eight' type='checkbox' checked><input name='nine' type='checkbox' value='unset'>" +
"<input name='ten' value='text' disabled>" +
"<input name='eleven' value='text' type='button'>" +
"<input name='twelve' value='text' type='image'>" +
"</form>";
Document doc = Jsoup.parse(html);
FormElement form = (FormElement) doc.select("form").first();
Expand Down

0 comments on commit 144835d

Please sign in to comment.