Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed: Wrong uploaded file checked in Image Management (OFBIZ-12297)
When I secured the uploads with OFBIZ-12080 I made a mistake and checked the
wrong uploaded file in Image Management.
  • Loading branch information
JacquesLeRoux committed Jul 29, 2021
1 parent 2f5b8d3 commit 8d49af4
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -154,7 +154,7 @@ public static Map<String, Object> addMultipleuploadForProduct(DispatchContext dc
RandomAccessFile out = new RandomAccessFile(file, "rw");
out.write(imageData.array());
out.close();
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileToCheck, "Image", delegator)) {
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(file.toString(), "Image", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedImageFormats", locale);
return ServiceUtil.returnError(errorMessage);
}
Expand All @@ -178,7 +178,7 @@ public static Map<String, Object> addMultipleuploadForProduct(DispatchContext dc
RandomAccessFile outFile = new RandomAccessFile(fileOriginal, "rw");
outFile.write(imageData.array());
outFile.close();
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileToCheck, "Image", delegator)) {
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileOriginal.toString(), "Image", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedImageFormats", locale);
return ServiceUtil.returnError(errorMessage);
}
Expand Down

0 comments on commit 8d49af4

Please sign in to comment.