Minor: Return bad Image MIME type to API client

This commit is contained in:
Michael Vorburger
2020-10-22 06:04:02 +03:00
committed by Petri Tuomola
parent 64d0b1fe58
commit cb3260b61f
2 changed files with 3 additions and 3 deletions
@@ -20,7 +20,7 @@ package org.apache.fineract.infrastructure.core.exception;
public class ImageUploadException extends AbstractPlatformDomainRuleException {
public ImageUploadException() {
super("error.msg.image.type.upload", "Only image files of type GIF,PNG and JPG are allowed ");
public ImageUploadException(String badMimeType) {
super("error.msg.image.type.upload", "Only image files of type GIF,PNG and JPG are allowed, but not: " + badMimeType);
}
}
@@ -121,7 +121,7 @@ public final class ContentRepositoryUtils {
public static void validateImageMimeType(final String mimeType) {
if (!(mimeType.equalsIgnoreCase(ImageMIMEtype.GIF.getValue()) || mimeType.equalsIgnoreCase(ImageMIMEtype.JPEG.getValue())
|| mimeType.equalsIgnoreCase(ImageMIMEtype.PNG.getValue()))) {
throw new ImageUploadException();
throw new ImageUploadException(mimeType);
}
}