Open OverDrone opened 3 years ago
Is there a way to resolve this? As there is no way to return a content in case that we experience an error after upload (as we do some checks after the file upload finished). And if we simply remove the "Content-Length=0" that is set by default, we don't get any Content-Length at all anymore.
CoreDefaultResponseHeadersHandler always writes header Content-Length=0 If some error detected, like incorrect offset, TUS calls HttpServletResponse.sendError() with some message. In other words there is nonempty response with header Content-Length=0. Undertow throws exception, probably because it allocates output buffer based on Content-Length header.
How to fix:
Remove setting Content-Length=0 from CoreDefaultResponseHeadersHandler. Or overwrite Content-Length header before calling HttpServletResponse.sendError()