Skip to content

Commit

Permalink
Fix character encoding for binary files
Browse files Browse the repository at this point in the history
  • Loading branch information
ramari16 committed Jan 28, 2025
1 parent fa96cda commit 81cf6ae
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.util.Map;
Expand Down Expand Up @@ -240,15 +241,16 @@ public Response queryResult(String rsURL, String queryId, QueryRequest queryRequ
HttpClientUtil.composeURL(rsURL, pathName), createHeaders(queryRequest.getResourceCredentials()), body
);

String content = httpClientUtil.readObjectFromResponse(resourcesResponse, StandardCharsets.ISO_8859_1);
if (resourcesResponse.getStatusLine().getStatusCode() != 200) {
logger.error("ResourceRS did not return a 200");
HttpClientUtil.throwResponseError(resourcesResponse, rsURL);
}
return Response.ok(content).build();
return Response.ok(resourcesResponse.getEntity().getContent()).build();
} catch (JsonProcessingException e) {
logger.error("Unable to encode resource credentials");
throw new NotAuthorizedException("Unable to encode resource credentials", e);
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
closeHttpResponse(resourcesResponse);
}
Expand Down

0 comments on commit 81cf6ae

Please sign in to comment.