aleph

valerauko 2023-04-13T11:38:59.127019Z

Question: on an older version of aleph, when using the ring multipart-params middleware, if the user POSTs an empty file the request body becomes nil and that causes an exception in multipart-params (or to be precise the apache commons-io library it uses). Does this still repro with latest aleph? If so maybe using a nullInputStream for body if it's empty might be a good idea?

Matthew Davidson 2023-04-13T15:02:12.275099Z

Haven't checked lately, but I haven't personally done anything with related code that I can recall. Arnaud or Moritz would know; they've both done some multipart work in the last year. Ironically, we have the opposite problem on the client. The client is meant to mimic clj-http's behavior, and there, clj-http returns nil while we return an empty InputStream.

Arnaud Geiser 2023-04-16T19:11:53.776299Z

Sorry for the delay. > Does this still repro with latest aleph? Yes, we have done nothing regarding this behavior. So I don't expect any changes there. But we improved the way multipart are handled inside Aleph, so maybe "decode-request" can be used for your needs now [1]. You should be able to support files through "Manual cleanup". > If so maybe using a nullInputStream for body if it's empty might be a good idea? Can you provide us some code so I can have a look? [1] : https://cljdoc.org/d/aleph/aleph/0.6.1/doc/http/handling-multipart-requests