mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 08:16:32 +03:00
fix: don't break long group names with non-ASCII characters
The fix is in mail-builder 0.4.4.
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -3354,9 +3354,9 @@ checksum = "9106e1d747ffd48e6be5bb2d97fa706ed25b144fbee4d5c02eae110cd8d6badd"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mail-builder"
|
name = "mail-builder"
|
||||||
version = "0.4.3"
|
version = "0.4.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0926cff74776d4af100a95c90a6649486659526ce638bee6648ecc9c41051810"
|
checksum = "900998f307338c4013a28ab14d760b784067324b164448c6d98a89e44810473b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mailparse"
|
name = "mailparse"
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ iroh-gossip = { version = "0.35", default-features = false, features = ["net"] }
|
|||||||
iroh = { version = "0.35", default-features = false }
|
iroh = { version = "0.35", default-features = false }
|
||||||
kamadak-exif = "0.6.1"
|
kamadak-exif = "0.6.1"
|
||||||
libc = { workspace = true }
|
libc = { workspace = true }
|
||||||
mail-builder = { version = "0.4.3", default-features = false }
|
mail-builder = { version = "0.4.4", default-features = false }
|
||||||
mailparse = { workspace = true }
|
mailparse = { workspace = true }
|
||||||
mime = "0.3.17"
|
mime = "0.3.17"
|
||||||
num_cpus = "1.17"
|
num_cpus = "1.17"
|
||||||
|
|||||||
@@ -4779,3 +4779,25 @@ async fn test_no_avatar_in_adhoc_chats() -> Result<()> {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Tests that long group name with non-ASCII characters is correctly received
|
||||||
|
/// by other members.
|
||||||
|
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||||
|
async fn test_long_group_name() -> Result<()> {
|
||||||
|
let mut tcm = TestContextManager::new();
|
||||||
|
let alice = &tcm.alice().await;
|
||||||
|
let bob = &tcm.bob().await;
|
||||||
|
|
||||||
|
let group_name = "δδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδ";
|
||||||
|
let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, group_name).await?;
|
||||||
|
let alice_bob_contact_id = alice.add_or_lookup_contact_id(bob).await;
|
||||||
|
add_contact_to_chat(alice, alice_chat_id, alice_bob_contact_id).await?;
|
||||||
|
let sent = alice
|
||||||
|
.send_text(alice_chat_id, "Hi! I created a group.")
|
||||||
|
.await;
|
||||||
|
let bob_chat_id = bob.recv_msg(&sent).await.chat_id;
|
||||||
|
let bob_chat = Chat::load_from_db(bob, bob_chat_id).await?;
|
||||||
|
assert_eq!(bob_chat.name, group_name);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|||||||
@@ -91,8 +91,11 @@ fn test_render_rfc724_mid() {
|
|||||||
|
|
||||||
fn render_header_text(text: &str) -> String {
|
fn render_header_text(text: &str) -> String {
|
||||||
let mut output = Vec::<u8>::new();
|
let mut output = Vec::<u8>::new();
|
||||||
|
|
||||||
|
// Some non-zero length of the header name.
|
||||||
|
let bytes_written = 20;
|
||||||
mail_builder::headers::text::Text::new(text.to_string())
|
mail_builder::headers::text::Text::new(text.to_string())
|
||||||
.write_header(&mut output, 0)
|
.write_header(&mut output, bytes_written)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
String::from_utf8(output).unwrap()
|
String::from_utf8(output).unwrap()
|
||||||
|
|||||||
Reference in New Issue
Block a user