-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Closed
Copy link
Labels
in: testIssues in the test moduleIssues in the test modulein: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: ideal-for-contributionAn issue that a contributor can help us withAn issue that a contributor can help us withstatus: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: enhancementA general enhancementA general enhancement
Description
Stephen Liang opened SPR-13979 and commented
Overview
The params method in HtmlUnitRequestBuilder does not check if a parameter contains a File payload, which results in a File input box to get its value (the path to the file) and submit it as a key/value rather than the payload being uploaded as multipart form data.
For Reference
webRequest.getRequestParameters() is a KeyDataPair which contains a field called fileObject_. This field should be recognized and used in place of the value_ field which is the name of the field, rather than the content of the file (when the parameter is has a file).
To Reproduce
- Create a simple file upload form, e.g.:
<html><head></head><body>
<form enctype='multipart/form-data' action='"/upload"' method='POST'>
<input type='file' name='image' />
<input type='submit' id='clickMe'>
</form>
</body>
</html>- Create a html unit test that sends the file path to the "file" input type
- Click on the submit button
Expected Result: The file contents are read and sent as form data
Actual Result: The file's name is sent as a key/value pair
Affects: 4.2 GA
0 votes, 5 watchers
Metadata
Metadata
Assignees
Labels
in: testIssues in the test moduleIssues in the test modulein: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: ideal-for-contributionAn issue that a contributor can help us withAn issue that a contributor can help us withstatus: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: enhancementA general enhancementA general enhancement