ok2c commented on code in PR #723:
URL: 
https://github.com/apache/httpcomponents-client/pull/723#discussion_r2347457885


##########
httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/HttpRFC7578Multipart.java:
##########
@@ -101,8 +101,12 @@ protected void formatMultipartHeader(final MultipartPart 
part, final OutputStrea
                     writeBytes("=\"", out);
                     if (value != null) {
                         if 
(name.equalsIgnoreCase(MimeConsts.FIELD_PARAM_FILENAME_START)) {
-                            final String encodedValue = "UTF-8''" + 
PercentCodec.RFC5987.encode(value);
-                            writeBytes(encodedValue, 
StandardCharsets.US_ASCII, out);
+                            if (value.startsWith("UTF-8''")) {
+                                writeBytes(value, StandardCharsets.US_ASCII, 
out);
+                            } else {
+                                final String encodedValue = "UTF-8''" + 
PercentCodec.RFC5987.encode(value);

Review Comment:
   @arturobernalg Could you please use `StringBuilder` and 
`PercentCodec#encode(StringBuilder, CharSequence)` here? Small optimization but 
still a bit less garbage.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to