From 441730e1f7a27541d52d1aaccc59a8204a96d079 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 21 Jul 2022 12:50:44 +0200 Subject: Fix open_mailbox --- src/imap/command/selected.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/imap/command') diff --git a/src/imap/command/selected.rs b/src/imap/command/selected.rs index 40e75e2..0be8ff2 100644 --- a/src/imap/command/selected.rs +++ b/src/imap/command/selected.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use anyhow::{bail, Result}; +use anyhow::Result; use boitalettres::proto::Request; use boitalettres::proto::Response; use imap_codec::types::command::CommandBody; @@ -99,7 +99,13 @@ impl<'a> SelectedContext<'a> { let mb_opt = self.user.open_mailbox(&name).await?; let mb = match mb_opt { Some(mb) => mb, - None => bail!("Mailbox does not exist"), + None => { + return Ok(( + Response::no("Destination mailbox does not exist")? + .with_extra_code(Code::TryCreate), + flow::Transition::None, + )) + } }; let (uidval, uid_map) = self.mailbox.copy(sequence_set, mb, uid).await?; -- cgit v1.2.3