galovics commented on code in PR #2339:
URL: https://github.com/apache/fineract/pull/2339#discussion_r884126020
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/ImagesApiResource.java:
##########
@@ -165,8 +165,13 @@ public Response retrieveImage(@PathParam("entity") final
String entityName, @Pat
try {
byte[] resizedImageBytes = resizedImage.getByteSource().read();
- final String clientImageAsBase64Text = imageDataURISuffix +
Base64.getMimeEncoder().encodeToString(resizedImageBytes);
- return Response.ok(clientImageAsBase64Text,
MediaType.TEXT_PLAIN_TYPE).build();
+
+ if(resizedImageBytes != null){
Review Comment:
Not sure if this is right to handle this way.
I assume the resizedImageBytes is only null when there wasn't any image to
resize. So I guess if we handle that use-case this way, the octet-stream branch
might still fail.
I'd rather ask the question, is it reasonable to deal with these type of
images?
Maybe at the beginning of this API, we shall simply put a check for this
case and return an HTTP 400 as retrieving an image that doesn't exist (to some
sense) is not necessarily something that makes sense for me, at least now.
Do you mind explaining the exact use-case for this extra logic?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]