Skip to content

Commit

Permalink
fix(host): Do not use meta header if the value has commas or colons
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederick888 committed Nov 23, 2023
1 parent d5ecc38 commit 1f82b77
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/model/messaging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,38 @@ pub mod tests {
);
}

#[test]
fn escaped_meta_headers_with_special_chars_test() {
let mut request = get_blank_compose();
request.configuration.allow_custom_headers = true;
request.configuration.meta_headers = true;
request.compose_details.custom_headers.push(CustomHeader {
name: "X-ExtEditorR-Foo".to_string(),
value: "bar, X-ExtEditorR: world, Priority: high".to_string(),
});
request.compose_details.custom_headers.push(CustomHeader {
name: "X-Foo".to_string(),
value: "bar, X-Hello: world".to_string(),
});

let output = to_eml_and_assert(&request);
let responses = {
let mut request = request.clone();
let mut output = output.as_bytes();
request.merge_from_eml(&mut output, 512).unwrap()
};

assert_eq!(1, responses.len());
assert_eq!(
request.compose_details.priority,
responses[0].compose_details.priority
);
assert_eq!(
request.compose_details.custom_headers,
responses[0].compose_details.custom_headers
);
}

#[test]
fn delete_send_on_exit_header_test() {
let mut eml = "Subject: Hello\r\n\r\nThis is a test.\r\n".as_bytes();
Expand Down

0 comments on commit 1f82b77

Please sign in to comment.