From 0d22fc7ac1b7626c5e806aa13bbf1b7897d1cf6a Mon Sep 17 00:00:00 2001 From: iequidoo Date: Wed, 4 Oct 2023 21:00:32 -0300 Subject: [PATCH 1/3] fix: Remove footer from reactions on the receiver side (#4780) Reactions do not have footer since 6d2ac30. However, mailing lists still add the footer to the messages, and receiver interpreted words as a reaction. --- src/reaction.rs | 26 ++++++++++++++++++++++++++ src/receive_imf.rs | 4 +++- src/simplify.rs | 9 +++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/reaction.rs b/src/reaction.rs index d8cb4450c..9731fe206 100644 --- a/src/reaction.rs +++ b/src/reaction.rs @@ -431,6 +431,32 @@ Content-Disposition: reaction\n\ assert_eq!(bob_reaction.emojis(), vec!["👍"]); assert_eq!(bob_reaction.as_str(), "👍"); + // Alice receives reaction to her message from Bob with a footer. + receive_imf( + &alice, + "To: alice@example.org\n\ +From: bob@example.net\n\ +Date: Today, 29 February 2021 00:00:10 -800\n\ +Message-ID: 56790@example.net\n\ +In-Reply-To: 12345@example.org\n\ +Subject: Meeting\n\ +Mime-Version: 1.0 (1.0)\n\ +Content-Type: text/plain; charset=utf-8\n\ +Content-Disposition: reaction\n\ +\n\ +😀\n\ +\n\ +--\n\ +_______________________________________________\n\ +Here's my footer -- bob@example.net" + .as_bytes(), + false, + ) + .await?; + + let reactions = get_msg_reactions(&alice, msg.id).await?; + assert_eq!(reactions.to_string(), "😀1"); + Ok(()) } diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 0e0edde5f..b16ce3805 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -35,6 +35,7 @@ use crate::param::{Param, Params}; use crate::peerstate::{Peerstate, PeerstateKeyType, PeerstateVerifiedStatus}; use crate::reaction::{set_msg_reaction, Reaction}; use crate::securejoin::{self, handle_securejoin_handshake, observe_securejoin_on_other_device}; +use crate::simplify; use crate::sql; use crate::stock_str; use crate::tools::{ @@ -1092,12 +1093,13 @@ async fn add_parts( for part in &mut mime_parser.parts { if part.is_reaction { + let reaction_str = simplify::remove_footers(part.msg.as_str()); set_msg_reaction( context, &mime_in_reply_to, orig_chat_id.unwrap_or_default(), from_id, - Reaction::from(part.msg.as_str()), + Reaction::from(reaction_str.as_str()), ) .await?; } diff --git a/src/simplify.rs b/src/simplify.rs index 1d07bb6a4..66d72f382 100644 --- a/src/simplify.rs +++ b/src/simplify.rs @@ -67,6 +67,15 @@ fn remove_nonstandard_footer<'a>(lines: &'a [&str]) -> (&'a [&'a str], bool) { (lines, false) } +/// Remove footers if any. +/// This also makes all newlines "\n", but why not. +pub(crate) fn remove_footers(msg: &str) -> String { + let lines = split_lines(msg); + let lines = remove_message_footer(&lines).0; + let lines = remove_nonstandard_footer(lines).0; + lines.join("\n") +} + pub(crate) fn split_lines(buf: &str) -> Vec<&str> { buf.split('\n').collect() } From a49282727b14800f70184afdbba3f17e1c55e919 Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 5 Oct 2023 04:41:13 +0000 Subject: [PATCH 2/3] ci: pin urllib3 version to <2 Otherwise it is impossible to build wheels. --- python/tox.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/tox.ini b/python/tox.ini index 99fd0c703..a68b4e729 100644 --- a/python/tox.ini +++ b/python/tox.ini @@ -25,6 +25,9 @@ deps = pytest-xdist pdbpp requests +# urllib3 2.0 does not work in manylinux2014 containers. +# https://github.com/deltachat/deltachat-core-rust/issues/4788 + urllib3<2 [testenv:.pkg] passenv = From 47dbac9b50808a240f6886b0323223384d62ab79 Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 5 Oct 2023 05:01:26 +0000 Subject: [PATCH 3/3] chore(release): prepare for 1.124.1 --- CHANGELOG.md | 11 +++++++++++ Cargo.lock | 10 +++++----- Cargo.toml | 2 +- deltachat-ffi/Cargo.toml | 2 +- deltachat-jsonrpc/Cargo.toml | 2 +- deltachat-jsonrpc/typescript/package.json | 2 +- deltachat-repl/Cargo.toml | 2 +- deltachat-rpc-server/Cargo.toml | 2 +- package.json | 2 +- release-date.in | 2 +- 10 files changed, 24 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ab0cc53b..34866af2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [1.124.1] - 2023-10-05 + +### Fixes + +- Remove footer from reactions on the receiver side ([#4780](https://github.com/deltachat/deltachat-core-rust/pull/4780)). + +### CI + +- Pin `urllib3` version to `<2`. ([#4788](https://github.com/deltachat/deltachat-core-rust/issues/4788)) + ## [1.124.0] - 2023-10-04 ### API-Changes @@ -2868,3 +2878,4 @@ https://github.com/deltachat/deltachat-core-rust/pulls?q=is%3Apr+is%3Aclosed [1.122.0]: https://github.com/deltachat/deltachat-core-rust/compare/v1.121.0...v1.122.0 [1.123.0]: https://github.com/deltachat/deltachat-core-rust/compare/v1.122.0...v1.123.0 [1.124.0]: https://github.com/deltachat/deltachat-core-rust/compare/v1.123.0...v1.124.0 +[1.124.1]: https://github.com/deltachat/deltachat-core-rust/compare/v1.124.0...v1.124.1 diff --git a/Cargo.lock b/Cargo.lock index 3843efa44..bfd31e42b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1103,7 +1103,7 @@ dependencies = [ [[package]] name = "deltachat" -version = "1.124.0" +version = "1.124.1" dependencies = [ "ansi_term", "anyhow", @@ -1179,7 +1179,7 @@ dependencies = [ [[package]] name = "deltachat-jsonrpc" -version = "1.124.0" +version = "1.124.1" dependencies = [ "anyhow", "async-channel", @@ -1203,7 +1203,7 @@ dependencies = [ [[package]] name = "deltachat-repl" -version = "1.124.0" +version = "1.124.1" dependencies = [ "ansi_term", "anyhow", @@ -1218,7 +1218,7 @@ dependencies = [ [[package]] name = "deltachat-rpc-server" -version = "1.124.0" +version = "1.124.1" dependencies = [ "anyhow", "deltachat", @@ -1243,7 +1243,7 @@ dependencies = [ [[package]] name = "deltachat_ffi" -version = "1.124.0" +version = "1.124.1" dependencies = [ "anyhow", "deltachat", diff --git a/Cargo.toml b/Cargo.toml index 529fbf4b2..d5cd1b740 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat" -version = "1.124.0" +version = "1.124.1" edition = "2021" license = "MPL-2.0" rust-version = "1.65" diff --git a/deltachat-ffi/Cargo.toml b/deltachat-ffi/Cargo.toml index 03628e0ce..9558bfeb1 100644 --- a/deltachat-ffi/Cargo.toml +++ b/deltachat-ffi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat_ffi" -version = "1.124.0" +version = "1.124.1" description = "Deltachat FFI" edition = "2018" readme = "README.md" diff --git a/deltachat-jsonrpc/Cargo.toml b/deltachat-jsonrpc/Cargo.toml index 5040bcef7..16a71cf9e 100644 --- a/deltachat-jsonrpc/Cargo.toml +++ b/deltachat-jsonrpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat-jsonrpc" -version = "1.124.0" +version = "1.124.1" description = "DeltaChat JSON-RPC API" edition = "2021" default-run = "deltachat-jsonrpc-server" diff --git a/deltachat-jsonrpc/typescript/package.json b/deltachat-jsonrpc/typescript/package.json index 65848a35f..7c098b98a 100644 --- a/deltachat-jsonrpc/typescript/package.json +++ b/deltachat-jsonrpc/typescript/package.json @@ -55,5 +55,5 @@ }, "type": "module", "types": "dist/deltachat.d.ts", - "version": "1.124.0" + "version": "1.124.1" } diff --git a/deltachat-repl/Cargo.toml b/deltachat-repl/Cargo.toml index 557c2699c..f46dfbb3f 100644 --- a/deltachat-repl/Cargo.toml +++ b/deltachat-repl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat-repl" -version = "1.124.0" +version = "1.124.1" license = "MPL-2.0" edition = "2021" diff --git a/deltachat-rpc-server/Cargo.toml b/deltachat-rpc-server/Cargo.toml index a8434ee83..a72fbe268 100644 --- a/deltachat-rpc-server/Cargo.toml +++ b/deltachat-rpc-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat-rpc-server" -version = "1.124.0" +version = "1.124.1" description = "DeltaChat JSON-RPC server" edition = "2021" readme = "README.md" diff --git a/package.json b/package.json index edec01fc9..0682f85b5 100644 --- a/package.json +++ b/package.json @@ -60,5 +60,5 @@ "test:mocha": "mocha -r esm node/test/test.js --growl --reporter=spec --bail --exit" }, "types": "node/dist/index.d.ts", - "version": "1.124.0" + "version": "1.124.1" } diff --git a/release-date.in b/release-date.in index 0539de2f7..741e6cba9 100644 --- a/release-date.in +++ b/release-date.in @@ -1 +1 @@ -2023-10-04 \ No newline at end of file +2023-10-05 \ No newline at end of file