[
https://issues.apache.org/jira/browse/CAMEL-26139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136563#comment-18136563
]
Claus Ibsen commented on CAMEL-26139:
-------------------------------------
PR: https://github.com/apache/camel/pull/28912
AttachmentHttpBinding (camel-servlet) now calls getParts() only when the
Content-Type is multipart/form-data. That is the only type the Servlet spec
supports for getParts(), so multipart/form-data is checked rather than
multipart/*. A GET or plain POST to an endpoint with
attachmentMultipartBinding=true now gets its body as usual instead of a 500.
_Claude Code on behalf of Claus Ibsen (davsclaus)_
> camel-servlet - attachmentMultipartBinding=true fails every non-multipart
> request with 500 Cannot populate attachments
> ----------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26139
> URL: https://issues.apache.org/jira/browse/CAMEL-26139
> Project: Camel
> Issue Type: Bug
> Components: camel-servlet
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found while adding the catalog body types of servlet (CAMEL-24961, PR #28395).
> h4. 1. attachmentMultipartBinding=true fails every request that is not
> multipart
> {{AttachmentHttpBinding.populateAttachments}} (main 2a465aa4814c, line 54)
> calls {{request.getParts()}} for every request, which throws for a request
> that is not {{multipart/form-data}}; the exception is wrapped as "Cannot
> populate attachments" (line 79) and the client gets a 500. So a servlet
> endpoint with {{attachmentMultipartBinding=true}} cannot serve a plain POST
> or GET. Checked on 4.24.0-SNAPSHOT with a java.net.http client against a
> servlet consumer in the Undertow servlet container.
> Proposed: only read the parts when the Content-Type is {{multipart/*}}.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)