Update message.rs

This commit is contained in:
rustmailer
2025-12-30 22:41:51 +08:00
parent 97143d55b8
commit f49929dd67
+8 -3
View File
@@ -161,7 +161,9 @@ impl MessageApi {
context context
.require_permission(Some(account_id), Permission::DATA_READ) .require_permission(Some(account_id), Permission::DATA_READ)
.await?; .await?;
Ok(Json(retrieve_email_content(account_id, message_id.0).await?)) Ok(Json(
retrieve_email_content(account_id, message_id.0).await?,
))
} }
/// Retrieves the envelope (metadata) of a specific message. /// Retrieves the envelope (metadata) of a specific message.
@@ -179,7 +181,9 @@ impl MessageApi {
context: ClientContext, context: ClientContext,
) -> ApiResult<Json<Envelope>> { ) -> ApiResult<Json<Envelope>> {
let account_id = account_id.0; let account_id = account_id.0;
context.require_account_access(account_id)?; context
.require_permission(Some(account_id), Permission::DATA_READ)
.await?;
let envelope = ENVELOPE_INDEX_MANAGER let envelope = ENVELOPE_INDEX_MANAGER
.get_envelope_by_id(account_id, message_id.0) .get_envelope_by_id(account_id, message_id.0)
.await? .await?
@@ -214,7 +218,8 @@ impl MessageApi {
context context
.require_permission(Some(account_id), Permission::DATA_RAW_DOWNLOAD) .require_permission(Some(account_id), Permission::DATA_RAW_DOWNLOAD)
.await?; .await?;
let reader = EML_INDEX_MANAGER.get_reader(account_id, message_id.0).await?; let message_id = message_id.0;
let reader = EML_INDEX_MANAGER.get_reader(account_id, message_id).await?;
let body = Body::from_async_read(reader); let body = Body::from_async_read(reader);
let attachment = Attachment::new(body) let attachment = Attachment::new(body)
.attachment_type(AttachmentType::Attachment) .attachment_type(AttachmentType::Attachment)