miniserve
miniserve copied to clipboard
Unable to upload .mhtml file
When attempting to upload a .mhtml file (created by Edge), .eml possibly affected as well, you get an error:
500 Internal Server Error Failed to process multipart request cause by: Nested multipart is not supported
In the console:
07:36:27 [ERROR] Failed to process multipart request
07:36:27 [ERROR] caused by: Nested multipart is not supported
07:36:27 [INFO] 10.10.1.21 "POST /upload?path=/ HTTP/1.1" 500 1113 ...
07:36:27 [ERROR] handler did not read whole payload and dispatcher could not drain read buf; return 500 and close connection
07:36:27 [ERROR] stream error: Handler dropped payload before reading EOF
Can you provide a example . mhtml file that fails to upload?
Yes, see https://datatracker.ietf.org/doc/html/rfc2557#section-4.2
file.mht
Content-Type: multipart/related; boundary="boundary-example";
type="text/html"
--boundary-example
Content-Type: text/html; charset="US-ASCII"
... ... <IMG SRC="fiction1/fiction2"> ... ...
... ... <IMG SRC="cid:[email protected]"> ... ...
--boundary-example
Content-Type: image/gif
Content-ID: <[email protected]>
Content-Location: fiction1/fiction2
--boundary-example
Content-Type: image/gif
Content-ID: <[email protected]>
Content-Location: fiction1/fiction3
--boundary-example--
I've narrowed it down, only files with extension .mht and .mhtml and the following line will cause a 500 Internal Server Error.
Content-Type: multipart/related
Related: https://github.com/actix/actix-web/issues/2695