Skip to content

Commit e4c2e0e

Browse files
author
Stephane Landelle
committed
Remove additional CRLF when there's no Content-Disposition, close #309
1 parent 93b6f3c commit e4c2e0e

File tree

1 file changed

+7
-5
lines changed
  • src/main/java/com/ning/http/multipart

1 file changed

+7
-5
lines changed

src/main/java/com/ning/http/multipart/Part.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ public boolean isRepeatable() {
210210
protected void sendStart(OutputStream out) throws IOException {
211211
out.write(EXTRA_BYTES);
212212
out.write(getPartBoundary());
213-
out.write(CRLF_BYTES);
214213
}
215214

216215
/**
@@ -220,10 +219,13 @@ protected void sendStart(OutputStream out) throws IOException {
220219
* @throws IOException If an IO problem occurs.
221220
*/
222221
protected void sendDispositionHeader(OutputStream out) throws IOException {
223-
out.write(CONTENT_DISPOSITION_BYTES);
224-
out.write(QUOTE_BYTES);
225-
out.write(MultipartEncodingUtil.getAsciiBytes(getName()));
226-
out.write(QUOTE_BYTES);
222+
if (getName() != null) {
223+
out.write(CRLF_BYTES);
224+
out.write(CONTENT_DISPOSITION_BYTES);
225+
out.write(QUOTE_BYTES);
226+
out.write(MultipartEncodingUtil.getAsciiBytes(getName()));
227+
out.write(QUOTE_BYTES);
228+
}
227229
}
228230

229231
/**

0 commit comments

Comments
 (0)