Subject: bug#63941: [PATCH] ; always CRLF before non-first boundary in multipart form

From: Stefan Kangas <[email-masked]>
Date: Mon, 3 Mar 2025 18:12:06 -0800

ozzloy <[email-masked]> writes:

> i've modified the commit with a couple goals.
>   + make the bug fixing part of the diff as small as possible.
>   + made the new tests look more like existing ones.
>   + rebased onto the head of the emacs-29 branch pulled in
>     earlier today.

Sorry for the delayed reply here.  I see that Stefan Monnier asked some
questions as well, could you please take a look?

Stefan Monnier writes:

> There remain some questions on this patch:
>
> 1- When `filedata` is neither a number nor a string this is treated the
>    same as an empty string.  Is that right?  Or should it just never
>    happen (in which case we should probably catch this case and signal
>    an error).
> 2- Should we also remove the `(unless (bolp)` in the default case?
>    I think we do (and my reading of your tests agrees, tho I couldn't
>    run your test suite on this version of the code, among other things
>    because it contains multiple tests with the same name, so it gives
>    me things like (error "Test
>    `test-mm-url-encode-multipart-form-data-A-ab-c' redefined")).
>
> I suspect we can also simply this code by moving the first
> (insert "--" boundary "\r\n") before the loop, and the second into the
> loop so we can make it insert "\r\n--" boundary "\r\n" (and thus remove
> \r\n from the end of each of the preceding branches).