From f7449da48537248ae278ecf7e7d642a9855e21ac Mon Sep 17 00:00:00 2001 From: Yutaro Ohno Date: Fri, 7 Apr 2023 00:43:00 +0900 Subject: [PATCH] Remove unnecessary steps from "multipart/form-data encoding algorithm" The specifications for the "multipart/form-data encoding algorithm" has changed [1], and the "_charset_" is not now handled here. Remove no longer necessary steps from the "multipart/form-data encoding algorithm". Similar to the "text/plain encoding algorithm" case fixed by f0818aa3 (Remove unnecessary steps from "text/plain encoding algorithm"). [1]: https://github.com/whatwg/html/pull/3645 Signed-off-by: Yutaro Ohno --- components/script/dom/htmlformelement.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 82075eb884f..404f3f4b648 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -1744,17 +1744,10 @@ pub fn encode_multipart_form_data( let mut result = vec![]; // Step 2 - let charset = encoding.name(); - - // Step 3 for entry in form_data.iter_mut() { - // 3.1 - if entry.name.to_ascii_lowercase() == "_charset_" && entry.ty == "hidden" { - entry.value = FormDatumValue::String(DOMString::from(charset.clone())); - } - // TODO: 3.2 + // TODO: Step 2.1 - // Step 4 + // Step 3 // https://tools.ietf.org/html/rfc7578#section-4 // NOTE(izgzhen): The encoding here expected by most servers seems different from // what spec says (that it should start with a '\r\n'). @@ -1772,6 +1765,7 @@ pub fn encode_multipart_form_data( result.append(&mut bytes); }, FormDatumValue::File(ref f) => { + let charset = encoding.name(); let extra = if charset.to_lowercase() == "utf-8" { format!( "filename=\"{}\"",