Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(email): Keep file type suffix on draft attachments (#1924)

Evan Hutnik5d0a8f67a9fa
diff --git a/rust/cloud-storage/email_service/src/api/email/drafts/add_attachment.rs b/rust/cloud-storage/email_service/src/api/email/drafts/add_attachment.rs
index caf447f3a7..1ec0d5c6ad 100644
--- a/rust/cloud-storage/email_service/src/api/email/drafts/add_attachment.rs
+++ b/rust/cloud-storage/email_service/src/api/email/drafts/add_attachment.rs
@@ -97,13 +97,9 @@ pub async fn handler(
) -> Result<Json<AddDraftAttachmentResponse>, AddDraftAttachmentError> {
validate_request(&ctx, link.id, draft_id, &req).await?;
- let (file_name, file_type) = match FileType::split_suffix_match(req.file_name.as_str()) {
- Some((file_name, extension)) => {
- let file_type: Option<FileType> = FileType::from_str(extension).ok();
- (file_name.to_string(), file_type)
- }
- None => (req.file_name, None),
- };
+ let file_type = FileType::split_suffix_match(req.file_name.as_str())
+ .and_then(|(_, extension)| FileType::from_str(extension).ok());
+ let file_name = req.file_name;
let content_type: ContentType = file_type.into();