Workaround for Synchronoss content-length limitation

Issue: SPR-17345
master
Rossen Stoyanchev 6 years ago
parent 983bce125f
commit 9064ef59f9
  1. 7
      spring-web/src/main/java/org/springframework/http/codec/multipart/SynchronossPartHttpMessageReader.java

@ -138,7 +138,7 @@ public class SynchronossPartHttpMessageReader extends LoggingCodecSupport implem
MediaType mediaType = headers.getContentType();
Assert.state(mediaType != null, "No content type set");
int length = Math.toIntExact(headers.getContentLength());
int length = getContentLength(headers);
Charset charset = Optional.ofNullable(mediaType.getCharset()).orElse(StandardCharsets.UTF_8);
MultipartContext context = new MultipartContext(mediaType.toString(), length, charset.name());
@ -176,7 +176,12 @@ public class SynchronossPartHttpMessageReader extends LoggingCodecSupport implem
listener.onError("Exception thrown while closing the parser", ex);
}
});
}
private int getContentLength(HttpHeaders headers) {
// Until this is fixed https://github.com/synchronoss/nio-multipart/issues/10
long length = headers.getContentLength();
return (int) length == length ? (int) length : -1;
}
}

Loading…
Cancel
Save