Skip to content

Commit 8d49af4

Browse files
committed
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.
1 parent 2f5b8d3 commit 8d49af4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public static Map<String, Object> addMultipleuploadForProduct(DispatchContext dc
154154
RandomAccessFile out = new RandomAccessFile(file, "rw");
155155
out.write(imageData.array());
156156
out.close();
157-
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileToCheck, "Image", delegator)) {
157+
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(file.toString(), "Image", delegator)) {
158158
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedImageFormats", locale);
159159
return ServiceUtil.returnError(errorMessage);
160160
}
@@ -178,7 +178,7 @@ public static Map<String, Object> addMultipleuploadForProduct(DispatchContext dc
178178
RandomAccessFile outFile = new RandomAccessFile(fileOriginal, "rw");
179179
outFile.write(imageData.array());
180180
outFile.close();
181-
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileToCheck, "Image", delegator)) {
181+
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileOriginal.toString(), "Image", delegator)) {
182182
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedImageFormats", locale);
183183
return ServiceUtil.returnError(errorMessage);
184184
}

0 commit comments

Comments
 (0)