Minor: Return bad Image MIME type to API client
This commit is contained in:
committed by
Petri Tuomola
parent
64d0b1fe58
commit
cb3260b61f
+2
-2
@@ -20,7 +20,7 @@ package org.apache.fineract.infrastructure.core.exception;
|
|||||||
|
|
||||||
public class ImageUploadException extends AbstractPlatformDomainRuleException {
|
public class ImageUploadException extends AbstractPlatformDomainRuleException {
|
||||||
|
|
||||||
public ImageUploadException() {
|
public ImageUploadException(String badMimeType) {
|
||||||
super("error.msg.image.type.upload", "Only image files of type GIF,PNG and JPG are allowed ");
|
super("error.msg.image.type.upload", "Only image files of type GIF,PNG and JPG are allowed, but not: " + badMimeType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -121,7 +121,7 @@ public final class ContentRepositoryUtils {
|
|||||||
public static void validateImageMimeType(final String mimeType) {
|
public static void validateImageMimeType(final String mimeType) {
|
||||||
if (!(mimeType.equalsIgnoreCase(ImageMIMEtype.GIF.getValue()) || mimeType.equalsIgnoreCase(ImageMIMEtype.JPEG.getValue())
|
if (!(mimeType.equalsIgnoreCase(ImageMIMEtype.GIF.getValue()) || mimeType.equalsIgnoreCase(ImageMIMEtype.JPEG.getValue())
|
||||||
|| mimeType.equalsIgnoreCase(ImageMIMEtype.PNG.getValue()))) {
|
|| mimeType.equalsIgnoreCase(ImageMIMEtype.PNG.getValue()))) {
|
||||||
throw new ImageUploadException();
|
throw new ImageUploadException(mimeType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user