Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

Commit c01012f

Browse files
author
Stephane Landelle
committed
Remove additional CRLF when there's no Content-Disposition, close AsyncHttpClient#309
1 parent 13b9bd4 commit c01012f

File tree

1 file changed

+7
-5
lines changed
  • api/src/main/java/org/asynchttpclient/multipart

1 file changed

+7
-5
lines changed

api/src/main/java/org/asynchttpclient/multipart/Part.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ public boolean isRepeatable() {
205205
protected void sendStart(OutputStream out) throws IOException {
206206
out.write(EXTRA_BYTES);
207207
out.write(getPartBoundary());
208-
out.write(CRLF_BYTES);
209208
}
210209

211210
/**
@@ -215,10 +214,13 @@ protected void sendStart(OutputStream out) throws IOException {
215214
* @throws IOException If an IO problem occurs.
216215
*/
217216
protected void sendDispositionHeader(OutputStream out) throws IOException {
218-
out.write(CONTENT_DISPOSITION_BYTES);
219-
out.write(QUOTE_BYTES);
220-
out.write(MultipartEncodingUtil.getAsciiBytes(getName()));
221-
out.write(QUOTE_BYTES);
217+
if (getName() != null) {
218+
out.write(CRLF_BYTES);
219+
out.write(CONTENT_DISPOSITION_BYTES);
220+
out.write(QUOTE_BYTES);
221+
out.write(MultipartEncodingUtil.getAsciiBytes(getName()));
222+
out.write(QUOTE_BYTES);
223+
}
222224
}
223225

224226
/**

0 commit comments

Comments
 (0)