mirror of
https://github.com/soywod/himalaya.git
synced 2024-12-04 08:50:33 +00:00
fix mailto parsing issue
This commit is contained in:
parent
eafeeb28a4
commit
7aa576400a
4 changed files with 20 additions and 26 deletions
|
@ -89,6 +89,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Fixed
|
||||
|
||||
- Fixed pre-release archives issue. [#492]
|
||||
- Fixed mailto parsing issue. [core#10]
|
||||
|
||||
## [1.0.0-beta.4] - 2024-04-16
|
||||
|
||||
|
@ -896,3 +897,4 @@ Few major concepts changed:
|
|||
|
||||
[#492]: https://github.com/pimalaya/himalaya/issues/492
|
||||
[#496]: https://github.com/pimalaya/himalaya/issues/496
|
||||
[core#10]: https://github.com/pimalaya/core/issues/10
|
||||
|
|
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1795,7 +1795,6 @@ dependencies = [
|
|||
"color-eyre",
|
||||
"email-lib",
|
||||
"himalaya",
|
||||
"mail-builder",
|
||||
"mml-lib",
|
||||
"once_cell",
|
||||
"pimalaya-tui",
|
||||
|
|
|
@ -42,7 +42,6 @@ clap_complete = "4.4"
|
|||
clap_mangen = "0.2"
|
||||
color-eyre = "0.6"
|
||||
email-lib = { version = "=0.26", default-features = false, features = ["tokio-rustls", "derive", "thread"] }
|
||||
mail-builder = "0.3"
|
||||
mml-lib = { version = "1", default-features = false, features = ["compiler", "interpreter", "derive"] }
|
||||
once_cell = "1.16"
|
||||
pimalaya-tui = { version = "=0.1", default-features = false, features = ["email", "path", "cli", "himalaya", "tracing", "sled"] }
|
||||
|
|
|
@ -3,7 +3,6 @@ use std::sync::Arc;
|
|||
use clap::Parser;
|
||||
use color_eyre::Result;
|
||||
use email::{backend::feature::BackendFeatureSource, config::Config};
|
||||
use mail_builder::MessageBuilder;
|
||||
use pimalaya_tui::{
|
||||
himalaya::{backend::BackendBuilder, editor},
|
||||
terminal::{cli::printer::Printer, config::TomlConfig as _},
|
||||
|
@ -62,40 +61,35 @@ impl MessageMailtoCommand {
|
|||
.build()
|
||||
.await?;
|
||||
|
||||
let mut builder = MessageBuilder::new().to(self.url.path());
|
||||
let mut body = String::new();
|
||||
let mut msg = Vec::<u8>::new();
|
||||
let mut body = Vec::<u8>::new();
|
||||
|
||||
msg.extend(b"Content-Type: text/plain; charset=utf-8\r\n");
|
||||
|
||||
for (key, val) in self.url.query_pairs() {
|
||||
match key {
|
||||
key if key.eq_ignore_ascii_case("in-reply-to") => {
|
||||
builder = builder.in_reply_to(val.to_string());
|
||||
}
|
||||
key if key.eq_ignore_ascii_case("cc") => {
|
||||
builder = builder.cc(val.to_string());
|
||||
}
|
||||
key if key.eq_ignore_ascii_case("bcc") => {
|
||||
builder = builder.bcc(val.to_string());
|
||||
}
|
||||
key if key.eq_ignore_ascii_case("subject") => {
|
||||
builder = builder.subject(val.to_string());
|
||||
}
|
||||
key if key.eq_ignore_ascii_case("body") => {
|
||||
body += &val;
|
||||
}
|
||||
_ => (),
|
||||
if key.eq_ignore_ascii_case("body") {
|
||||
body.extend(val.as_bytes());
|
||||
} else {
|
||||
msg.extend(key.as_bytes());
|
||||
msg.extend(b": ");
|
||||
msg.extend(val.as_bytes());
|
||||
msg.extend(b"\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
match account_config.find_full_signature() {
|
||||
Some(ref sig) => builder = builder.text_body(body + "\n\n" + sig),
|
||||
None => builder = builder.text_body(body),
|
||||
msg.extend(b"\r\n");
|
||||
msg.extend(body);
|
||||
|
||||
if let Some(sig) = account_config.find_full_signature() {
|
||||
msg.extend(b"\r\n");
|
||||
msg.extend(sig.as_bytes());
|
||||
}
|
||||
|
||||
let tpl = account_config
|
||||
.generate_tpl_interpreter()
|
||||
.with_show_only_headers(account_config.get_message_write_headers())
|
||||
.build()
|
||||
.from_msg_builder(builder)
|
||||
.from_bytes(msg)
|
||||
.await?
|
||||
.into();
|
||||
|
||||
|
|
Loading…
Reference in a new issue