summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormdecimus <mauro@stalw.art>2024-09-15 14:43:35 +0200
committermdecimus <mauro@stalw.art>2024-09-15 14:43:35 +0200
commit49bce9a3dede38c23760588b6b75aa8780d6624e (patch)
tree862b649a3c1270f7223dbb3414aaa627e1b70586
parentab77a0aca81a9e4fa652ea260d77864f5772e087 (diff)
Properly decode undelete account name (fixes #761)
-rw-r--r--crates/jmap/src/api/management/enterprise/undelete.rs7
1 files 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<HttpResponse> {
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())?;