From 49bce9a3dede38c23760588b6b75aa8780d6624e Mon Sep 17 00:00:00 2001 From: mdecimus Date: Sun, 15 Sep 2024 14:43:35 +0200 Subject: [PATCH] Properly decode undelete account name (fixes #761) --- crates/jmap/src/api/management/enterprise/undelete.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/jmap/src/api/management/enterprise/undelete.rs b/crates/jmap/src/api/management/enterprise/undelete.rs index 91e3d4c9..e14de9ed 100644 --- a/crates/jmap/src/api/management/enterprise/undelete.rs +++ b/crates/jmap/src/api/management/enterprise/undelete.rs @@ -24,6 +24,7 @@ use utils::{url_params::UrlParams, BlobHash}; use crate::{ api::{ http::{HttpSessionData, ToHttpResponse}, + management::decode_path_element, HttpRequest, HttpResponse, JsonResponse, }, email::ingest::{IngestEmail, IngestSource}, @@ -61,11 +62,12 @@ impl JMAP { ) -> trc::Result { match (path.get(2).copied(), req.method()) { (Some(account_name), &Method::GET) => { + let account_name = decode_path_element(account_name); let account_id = self .core .storage .data - .get_principal_id(account_name) + .get_principal_id(account_name.as_ref()) .await? .ok_or_else(|| trc::ResourceEvent::NotFound.into_err())?; let mut deleted = self.core.list_deleted(account_id).await?; @@ -111,11 +113,12 @@ impl JMAP { .into_http_response()) } (Some(account_name), &Method::POST) => { + let account_name = decode_path_element(account_name); let account_id = self .core .storage .data - .get_principal_id(account_name) + .get_principal_id(account_name.as_ref()) .await? .ok_or_else(|| trc::ResourceEvent::NotFound.into_err())?;