Added support for webp.

This commit is contained in:
Jesse Brault 2024-08-01 07:52:32 -05:00
parent 81424eb2e6
commit 9983b0ef95

View File

@ -51,6 +51,7 @@ public class S3ImageService implements ImageService {
case "jpg", "jpeg" -> "image/jpeg"; case "jpg", "jpeg" -> "image/jpeg";
case "png" -> "image/png"; case "png" -> "image/png";
case "svg" -> "image/svg+xml"; case "svg" -> "image/svg+xml";
case "webp" -> "image/webp";
default -> throw new IllegalArgumentException("Cannot determine mime type for extension: " + extension); default -> throw new IllegalArgumentException("Cannot determine mime type for extension: " + extension);
}; };
} else { } else {
@ -63,9 +64,10 @@ public class S3ImageService implements ImageService {
case "image/jpeg" -> "jpg"; case "image/jpeg" -> "jpg";
case "image/png" -> "png"; case "image/png" -> "png";
case "image/svg+xml" -> "svg"; case "image/svg+xml" -> "svg";
case "image/webp" -> "webp";
default -> throw new ImageException( default -> throw new ImageException(
ImageException.Type.UNKNOWN_MIME_TYPE, ImageException.Type.UNKNOWN_MIME_TYPE,
"unknown mime type: " + mimeType "Unknown mime type: " + mimeType
); );
}; };
} }