From 60e3b252fd97ff5f89411b6b5a3c82e4e592b057 Mon Sep 17 00:00:00 2001 From: Oleksii-Klimov <133792808+Oleksii-Klimov@users.noreply.github.com> Date: Fri, 26 Jul 2024 14:43:07 +0100 Subject: [PATCH] fix: handle blank content encoding (#412) --- .../java/com/epam/aidial/core/service/ResourceService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/epam/aidial/core/service/ResourceService.java b/src/main/java/com/epam/aidial/core/service/ResourceService.java index 8f80b9021..06e3445db 100644 --- a/src/main/java/com/epam/aidial/core/service/ResourceService.java +++ b/src/main/java/com/epam/aidial/core/service/ResourceService.java @@ -23,6 +23,7 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.BlobMetadata; @@ -604,7 +605,7 @@ private static Result blobToResult(Blob blob, BlobMetadata meta) { String encoding = meta.getContentMetadata().getContentEncoding(); try (InputStream stream = blob.getPayload().openStream()) { body = stream.readAllBytes(); - if (encoding != null) { + if (!StringUtils.isBlank(encoding)) { body = Compression.decompress(encoding, body); } }