Skip to content

Commit 543372a

Browse files
committed
add note of related method
1 parent 5f1bff3 commit 543372a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1904,10 +1904,14 @@ public static String decodeFileName(String originalFileName) {
19041904
/**
19051905
* Verifies that an uploaded file is a valid png or jpg image file. Performs both MIME type checking and content validation.
19061906
*
1907+
* Note: This is similar to the isFileOfImageType which is used for collection feature items. This method works with PrimeFaces UploadedFile vs File, limits to jpg and png (as the UI states), uses
1908+
* ImageIO to read the content, and checks size (as the caller of isFileOfImageType does). It avoids using Tika in the core (as we once tried to do) and is potentially slower but more thorough as it
1909+
* will confirm the image is not corrupt. Work could be done to merge the two use cases.
1910+
*
19071911
* @param uploadedFile
19081912
* the file to verify
19091913
* @param maxSize
1910-
* maximum allowed file size in bytes
1914+
* maximum allowed file size in bytes
19111915
*/
19121916
public static boolean isUploadedFileAnImage(UploadedFile uploadedFile, long maxSize) {
19131917
if (uploadedFile == null) {

0 commit comments

Comments
 (0)