OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Verify that attachment filenames are not normalized</title> |
| 3 <script src="/js-test-resources/js-test.js"></script> |
| 4 <script> |
| 5 description(document.title); |
| 6 var jsTestIsAsync = true; |
| 7 |
| 8 var request = { |
| 9 field: "attachment", |
| 10 filename: decodeURIComponent("z%CC%87o%CC%81%C5%82c%CC%81.txt"), |
| 11 type: "text/plain", |
| 12 content: "hello world" |
| 13 }; |
| 14 var file = new File([request.content], request.filename, {type: request.type}); |
| 15 shouldBe("file.name", "request.filename"); |
| 16 |
| 17 var data = new FormData(); |
| 18 data.append(request.field, file); |
| 19 |
| 20 var xhr = new XMLHttpRequest(); |
| 21 var match, response; |
| 22 xhr.open("POST", "resources/multipart-post-echo.php", true); |
| 23 xhr.send(data); |
| 24 xhr.onreadystatechange = function(e) { |
| 25 if (xhr.readyState !== xhr.DONE) |
| 26 return; |
| 27 match = xhr.responseText.match(/^(.*)=(.*):(.*):(.*)$/); |
| 28 response = { |
| 29 field: match[1], |
| 30 filename: match[2], |
| 31 type: match[3], |
| 32 content: match[4] |
| 33 }; |
| 34 |
| 35 shouldBe("response.field", "request.field"); |
| 36 shouldBe("response.filename", "request.filename"); |
| 37 shouldBe("response.type", "request.type"); |
| 38 shouldBe("response.content", "request.content"); |
| 39 finishJSTest(); |
| 40 }; |
| 41 </script> |
| 42 </body> |
| 43 </html> |
OLD | NEW |