mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2024-10-23 06:57:26 +00:00
Fix: SELECT QRESYNC without speficying uid causes panic (#67)
This commit is contained in:
parent
634c66e987
commit
0e3a226d9f
3 changed files with 28 additions and 2 deletions
|
@ -321,6 +321,21 @@ mod tests {
|
|||
.into(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"A12 SELECT \"INBOX\" (QRESYNC (1693237464 16582))\r\n",
|
||||
select::Arguments {
|
||||
mailbox_name: "INBOX".to_string(),
|
||||
tag: "A12".to_string(),
|
||||
condstore: false,
|
||||
qresync: QResync {
|
||||
uid_validity: 1693237464,
|
||||
modseq: 16582,
|
||||
known_uids: None,
|
||||
seq_match: None,
|
||||
}
|
||||
.into(),
|
||||
},
|
||||
),
|
||||
] {
|
||||
assert_eq!(
|
||||
receiver
|
||||
|
|
|
@ -98,6 +98,13 @@ pub fn spawn_writer(mut stream: Event, span: tracing::Span) -> mpsc::Sender<Even
|
|||
while let Some(event) = rx.recv().await {
|
||||
match event {
|
||||
Event::Bytes(bytes) => {
|
||||
tracing::trace!(
|
||||
parent: &span,
|
||||
event = "write",
|
||||
data = std::str::from_utf8(bytes.as_ref()).unwrap_or_default(),
|
||||
size = bytes.len()
|
||||
);
|
||||
|
||||
match stream_tx.write_all(bytes.as_ref()).await {
|
||||
Ok(_) => {
|
||||
let _ = stream_tx.flush().await;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use imap_proto::{
|
||||
protocol::{fetch, list::ListItem, select::Response, ImapResponse},
|
||||
protocol::{fetch, list::ListItem, select::Response, ImapResponse, Sequence},
|
||||
receiver::Request,
|
||||
Command, ResponseCode, StatusResponse,
|
||||
};
|
||||
|
@ -93,7 +93,11 @@ impl<T: AsyncRead> Session<T> {
|
|||
tag: String::new(),
|
||||
sequence_set: qresync
|
||||
.known_uids
|
||||
.unwrap_or_else(|| qresync.seq_match.unwrap().1),
|
||||
.or_else(|| qresync.seq_match.map(|(_, s)| s))
|
||||
.unwrap_or(Sequence::Range {
|
||||
start: 1.into(),
|
||||
end: None,
|
||||
}),
|
||||
attributes: vec![fetch::Attribute::Flags],
|
||||
changed_since: qresync.modseq.into(),
|
||||
include_vanished: true,
|
||||
|
|
Loading…
Reference in a new issue