Spiegel von
https://github.com/dani-garcia/vaultwarden.git
synchronisiert 2025-03-12 16:47:03 +01:00
Correction of string read
Dieser Commit ist enthalten in:
Ursprung
30d90015d7
Commit
2d58f0a8a6
4 geänderte Dateien mit 10 neuen und 17 gelöschten Zeilen
|
@ -4,8 +4,8 @@ workspace = { members = ["macros"] }
|
||||||
name = "vaultwarden"
|
name = "vaultwarden"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
authors = ["Daniel García <dani-garcia@users.noreply.github.com>"]
|
authors = ["Daniel García <dani-garcia@users.noreply.github.com>"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
rust-version = "1.83.0"
|
rust-version = "1.85.0"
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
repository = "https://github.com/dani-garcia/vaultwarden"
|
repository = "https://github.com/dani-garcia/vaultwarden"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.84.1"
|
channel = "1.85"
|
||||||
components = [ "rustfmt", "clippy" ]
|
components = [ "rustfmt", "clippy" ]
|
||||||
profile = "minimal"
|
profile = "minimal"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
max_width = 120
|
max_width = 120
|
||||||
newline_style = "Unix"
|
newline_style = "Unix"
|
||||||
use_small_heuristics = "Off"
|
use_small_heuristics = "Off"
|
||||||
|
|
19
src/mail.rs
19
src/mail.rs
|
@ -10,7 +10,7 @@ use lettre::{
|
||||||
Address, AsyncSendmailTransport, AsyncSmtpTransport, AsyncTransport, Tokio1Executor,
|
Address, AsyncSendmailTransport, AsyncSmtpTransport, AsyncTransport, Tokio1Executor,
|
||||||
};
|
};
|
||||||
use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
|
use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
|
||||||
use std::{env::consts::EXE_SUFFIX, io::Read, str::FromStr};
|
use std::{env::consts::EXE_SUFFIX, fs, str::FromStr};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
api::EmptyResult,
|
api::EmptyResult,
|
||||||
|
@ -650,14 +650,12 @@ async fn send_email(address: &str, subject: &str, body_html: String, body_text:
|
||||||
Some(true) => DkimSigningAlgorithm::Rsa,
|
Some(true) => DkimSigningAlgorithm::Rsa,
|
||||||
_ => DkimSigningAlgorithm::Ed25519,
|
_ => DkimSigningAlgorithm::Ed25519,
|
||||||
};
|
};
|
||||||
let mut key = String::with_capacity(4096);
|
let sig = match fs::read_to_string(sig) {
|
||||||
let sig = match std::fs::File::open(sig) {
|
Err(e) => {
|
||||||
Ok(mut f) => {
|
debug!("Cannot read DKIM file. Err is {:?}", e);
|
||||||
if let Err(e) = f.read_to_string(&mut key) {
|
|
||||||
debug!("Cannot read DKIM file. Err is {:?}", e);
|
|
||||||
None
|
None
|
||||||
} else {
|
},
|
||||||
key.shrink_to_fit();
|
Ok(key) => {
|
||||||
match DkimSigningKey::new(&key, algo) {
|
match DkimSigningKey::new(&key, algo) {
|
||||||
Ok(d) => Some(d),
|
Ok(d) => Some(d),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -666,11 +664,6 @@ async fn send_email(address: &str, subject: &str, body_html: String, body_text:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
Err(e) => {
|
|
||||||
debug!("Cannot read DKIM file. Err is {:?}", e);
|
|
||||||
None
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
match (sig, infos.split(':').collect::<Vec<&str>>()) {
|
match (sig, infos.split(':').collect::<Vec<&str>>()) {
|
||||||
(Some(sig), split2) if split2.len() == 2 => {
|
(Some(sig), split2) if split2.len() == 2 => {
|
||||||
|
|
Laden …
Tabelle hinzufügen
In neuem Issue referenzieren