Skip to content

Commit

Permalink
fix attachment filename on downloads brycx#30
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsen-alizadeh committed Jun 4, 2023
1 parent 931d2f4 commit f46e7dc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mailtutan-lib/src/api/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,20 @@ pub async fn download_attachment(Path((id, cid)): Path<(usize, String)>) -> impl
if attachment.cid == cid {
return (
StatusCode::OK,
[("Content-Disposition", "attachment; filename=\"attachment\"")],
[(
"Content-Disposition",
format!("attachment; filename=\"{}\"", attachment.filename),
)],
attachment.body.clone(),
);
}
}

(StatusCode::OK, [("Content-Type", "message/rfc822")], vec![])
(
StatusCode::OK,
[("Content-Type", "message/rfc822".to_string())],
vec![],
)
}

pub async fn show_json(Path(id): Path<usize>) -> Json<Message> {
Expand Down

0 comments on commit f46e7dc

Please sign in to comment.