[ 
https://issues.apache.org/jira/browse/SOLR-10973?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068195#comment-16068195
 ] 

ASF subversion and git services commented on SOLR-10973:
--------------------------------------------------------

Commit fdd6205df9054c0498bd8846d66db6f30d5d8476 in lucene-solr's branch 
refs/heads/branch_6x from [~kwri...@metacarta.com]
[ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=fdd6205 ]

SOLR-10973: Use the correct constructor for InputStreamBody.


> SolrJ: ContentType is not parsed properly in HttpSolrClient
> -----------------------------------------------------------
>
>                 Key: SOLR-10973
>                 URL: https://issues.apache.org/jira/browse/SOLR-10973
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: SolrJ
>    Affects Versions: 6.6
>            Reporter: Karl Wright
>            Assignee: Karl Wright
>
> When multipart posting is used, the content type is passed to the constructor 
> for InputStreamBody as a simple string:
> {code}
>             parts.add(new FormBodyPart(name,
>                 new InputStreamBody(
>                     content.getStream(),
>                     contentType,
>                     content.getName())));
> {code}
> This is incorrect; HttpClient does not parse that contentType as anything 
> other than a mime type and thus blows up when you pass in something like 
> "text/plain; charset=utf-8".  The correct code is:
> {code}
>             parts.add(new FormBodyPart(name,
>                 new InputStreamBody(
>                     content.getStream(),
>                     ContentType.parse(contentType),
>                     content.getName())));
> {code}
> This was discovered by a ManifoldCF user.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to