Improve multipart filename handling a bit.

This commit is contained in:
Relintai 2024-03-10 09:32:01 +01:00
parent 75e8f68a24
commit aaf744aad0

View File

@ -197,10 +197,15 @@ void HTTPParser::_process_multipart_header_value(const String &val) {
_multipart_form_name.remove(_multipart_form_name.length() - 1);
}
} else if (kk == "filename") {
_multipart_form_filename = vs.get_slicec('=', 1);
_multipart_form_filename = _multipart_form_filename.replace("\"", "");
_multipart_form_is_file = true;
_multipart_form_filename = vs.get_slicec('=', 1);
if (_multipart_form_filename.length() >= 2 && _multipart_form_filename.begins_with("\"") && _multipart_form_filename.ends_with("\"")) {
_multipart_form_filename.remove(0);
_multipart_form_filename.remove(_multipart_form_filename.length() - 1);
}
if (_multipart_form_name.length() >= 2 && _multipart_form_name.begins_with("\"") && _multipart_form_name.ends_with("\"")) {
_multipart_form_name.remove(0);
_multipart_form_name.remove(_multipart_form_name.length() - 1);