miniserve icon indicating copy to clipboard operation
miniserve copied to clipboard

Unable to upload .mhtml file

Open Dialga opened this issue 4 years ago • 4 comments

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

Dialga avatar Mar 17 '22 08:03 Dialga

Can you provide a example . mhtml file that fails to upload?

aliemjay avatar Mar 18 '22 05:03 aliemjay

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--

Dialga avatar Mar 18 '22 08:03 Dialga

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

Dialga avatar Mar 18 '22 08:03 Dialga

Related: https://github.com/actix/actix-web/issues/2695

Dialga avatar Mar 18 '22 08:03 Dialga