Skip to content

Commit 2e105bb

Browse files
committed
add note of related method
1 parent 2cf2af6 commit 2e105bb

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
@@ -1915,10 +1915,14 @@ public static String decodeFileName(String originalFileName) {
19151915
/**
19161916
* Verifies that an uploaded file is a valid png or jpg image file. Performs both MIME type checking and content validation.
19171917
*
1918+
* 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
1919+
* 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
1920+
* will confirm the image is not corrupt. Work could be done to merge the two use cases.
1921+
*
19181922
* @param uploadedFile
19191923
* the file to verify
19201924
* @param maxSize
1921-
* maximum allowed file size in bytes
1925+
* maximum allowed file size in bytes
19221926
*/
19231927
public static boolean isUploadedFileAnImage(UploadedFile uploadedFile, long maxSize) {
19241928
if (uploadedFile == null) {

0 commit comments

Comments
 (0)