diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-03-20 17:31:54 +0100 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-03-20 17:31:54 +0100 |
commit | ed47855ef1a6c9d10d48080367ff8b280530e362 (patch) | |
tree | fc79b171718598c84034e212a6b8746a5fb6b782 /aero-proto/src | |
parent | 22e4f295556fdd4c25cf43983a56ff74acab7739 (diff) | |
download | aerogramme-ed47855ef1a6c9d10d48080367ff8b280530e362.tar.gz aerogramme-ed47855ef1a6c9d10d48080367ff8b280530e362.zip |
Share UniqueIdent between collections
Diffstat (limited to 'aero-proto/src')
-rw-r--r-- | aero-proto/src/dav.rs | 13 | ||||
-rw-r--r-- | aero-proto/src/imap/index.rs | 2 | ||||
-rw-r--r-- | aero-proto/src/imap/mailbox_view.rs | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/aero-proto/src/dav.rs b/aero-proto/src/dav.rs index 0ef615a..3420f86 100644 --- a/aero-proto/src/dav.rs +++ b/aero-proto/src/dav.rs @@ -27,6 +27,8 @@ use aero_dav::acltypes as acl; use aero_dav::realization::{All, self as all}; use aero_dav::xml as dxml; +type ArcUser = std::sync::Arc<User>; + pub struct Server { bind_addr: SocketAddr, login_provider: ArcLoginProvider, @@ -359,7 +361,15 @@ async fn propfind(user: std::sync::Arc<User>, req: Request<Incoming>, base_node: async fn report(user: std::sync::Arc<User>, req: Request<Incoming>, node: Box<dyn DavNode>) -> Result<Response<BoxBody<Bytes, std::io::Error>>> { let status = hyper::StatusCode::from_u16(207)?; - let report = deserialize::<cal::Report<All>>(req).await?; + let report = match deserialize::<cal::Report<All>>(req).await { + Ok(v) => v, + Err(e) => { + tracing::error!(err=?e, "unable to decode REPORT body"); + return Ok(Response::builder() + .status(400) + .body(text_body("Bad request"))?) + } + }; // Multiget is really like a propfind where Depth: 0|1|Infinity is replaced by an arbitrary // list of URLs @@ -492,7 +502,6 @@ async fn deserialize<T: dxml::Node<T>>(req: Request<Incoming>) -> Result<T> { //--- -type ArcUser = std::sync::Arc<User>; trait DavNode: Send { // ------- specialized logic diff --git a/aero-proto/src/imap/index.rs b/aero-proto/src/imap/index.rs index 3de46be..afe6991 100644 --- a/aero-proto/src/imap/index.rs +++ b/aero-proto/src/imap/index.rs @@ -4,7 +4,7 @@ use anyhow::{anyhow, Result}; use imap_codec::imap_types::sequence::{SeqOrUid, Sequence, SequenceSet}; use aero_collections::mail::uidindex::{ImapUid, ModSeq, UidIndex}; -use aero_collections::mail::unique_ident::UniqueIdent; +use aero_collections::unique_ident::UniqueIdent; pub struct Index<'a> { pub imap_index: Vec<MailIndex<'a>>, diff --git a/aero-proto/src/imap/mailbox_view.rs b/aero-proto/src/imap/mailbox_view.rs index 5154359..0ef33d6 100644 --- a/aero-proto/src/imap/mailbox_view.rs +++ b/aero-proto/src/imap/mailbox_view.rs @@ -17,7 +17,7 @@ use aero_collections::mail::mailbox::Mailbox; use aero_collections::mail::query::QueryScope; use aero_collections::mail::snapshot::FrozenMailbox; use aero_collections::mail::uidindex::{ImapUid, ImapUidvalidity, ModSeq}; -use aero_collections::mail::unique_ident::UniqueIdent; +use aero_collections::unique_ident::UniqueIdent; use crate::imap::attributes::AttributesProxy; use crate::imap::flags; |