From ed47855ef1a6c9d10d48080367ff8b280530e362 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 20 Mar 2024 17:31:54 +0100 Subject: Share UniqueIdent between collections --- aero-proto/src/dav.rs | 13 +++++++++++-- aero-proto/src/imap/index.rs | 2 +- aero-proto/src/imap/mailbox_view.rs | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) (limited to 'aero-proto') 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; + pub struct Server { bind_addr: SocketAddr, login_provider: ArcLoginProvider, @@ -359,7 +361,15 @@ async fn propfind(user: std::sync::Arc, req: Request, base_node: async fn report(user: std::sync::Arc, req: Request, node: Box) -> Result>> { let status = hyper::StatusCode::from_u16(207)?; - let report = deserialize::>(req).await?; + let report = match deserialize::>(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>(req: Request) -> Result { //--- -type ArcUser = std::sync::Arc; 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>, 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; -- cgit v1.2.3