Workaround for Synchronoss content-length limitation
Issue: SPR-17345
This commit is contained in:
@@ -127,7 +127,7 @@ public class SynchronossPartHttpMessageReader implements HttpMessageReader<Part>
|
|||||||
MediaType mediaType = headers.getContentType();
|
MediaType mediaType = headers.getContentType();
|
||||||
Assert.state(mediaType != null, "No content type set");
|
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);
|
Charset charset = Optional.ofNullable(mediaType.getCharset()).orElse(StandardCharsets.UTF_8);
|
||||||
MultipartContext context = new MultipartContext(mediaType.toString(), length, charset.name());
|
MultipartContext context = new MultipartContext(mediaType.toString(), length, charset.name());
|
||||||
|
|
||||||
@@ -165,7 +165,12 @@ public class SynchronossPartHttpMessageReader implements HttpMessageReader<Part>
|
|||||||
listener.onError("Exception thrown while closing the parser", ex);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user