Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit be384c554a8a445089739dd2e255f39624af8660 1 parent 2c1d2e5
Frederic Ye Aqua-Ye authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 stdlib/web/mail/mime.opa
6 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
Please sign in to comment.
Something went wrong with that request. Please try again.