Permalink
Browse files

[fix] mime: fixed bug with inline plain text detection

  • Loading branch information...
1 parent 2c1d2e5 commit be384c554a8a445089739dd2e255f39624af8660 @Aqua-Ye Aqua-Ye committed Apr 3, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 stdlib/web/mail/mime.opa
View
@@ -301,15 +301,19 @@ Mime = {{
| "multipart/related" ->
boundary = Header.extract_value("boundary", content_type_list)
multipart(body, boundary)
- | "text/plain" -> {plain=decoded_body}
| "text/html" -> {html=Xhtml.of_string(decoded_body)}
| _ ->
match Header.find("Content-Disposition", headers)
{none} -> {plain=decoded_body}
{some=cd} ->
+ if content_type == "text/plain" && cd == "inline" then
+ {plain=decoded_body}
+ else
filename = String.explode(";", cd)
|> List.map(String.trim, _)
|> Header.extract_value("filename", _)
+ if String.is_empty(filename) then {plain=decoded_body}
+ else
{ attachment = {
~filename
mimetype = content_type

0 comments on commit be384c5

Please sign in to comment.