Fix webapp data-stream not being closed in rare cases

This commit is contained in:
Lukas Rieger (Blue) 2024-09-29 22:20:17 +02:00
parent 79c225433b
commit 0d64bc0adf
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6

View File

@ -130,7 +130,7 @@ private void writeToResponse(CompressedInputStream data, HttpResponse response,
) {
response.addHeader("Content-Encoding", Compression.GZIP.getId());
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
try (OutputStream os = Compression.GZIP.compress(byteOut)) {
try (data; OutputStream os = Compression.GZIP.compress(byteOut)) {
data.decompress().transferTo(os);
}
byte[] compressedData = byteOut.toByteArray();