This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release18.12 by this push:
     new 1464dc0ecb Fixed: Unable to upload a CSV file (OFBIZ-12636)
1464dc0ecb is described below

commit 1464dc0ecb99edbec258634f8536a3d5f8ef097c
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Fri Sep 30 13:38:33 2022 +0200

    Fixed: Unable to upload a CSV file (OFBIZ-12636)
    
    While testing on "Upgrade pdfbox to 2.0.27 (OFBIZ-12698)" I found that I 
could
    not upload a valid PDF.
    
    Actually it was due to SecuredUpload::isValidCsvFile that was crashing when
    uploading this PDF file.
    
    I don't remember clearly but it was for a reason that I did not put the 
call to
    isValidCsvFile as the last check in isValidFile for the "all" and default 
case.
    
    As I can't remember now and it works for both CSV and PDF as "all" (when 
adding
    files from an user profile) I eventually decided to put "isValidCsvFile" at 
the
    end of the check. Unfortunately, it's complicate to test all possible 
combinations.
---
 .../src/main/java/org/apache/ofbiz/security/SecuredUpload.java        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/framework/security/src/main/java/org/apache/ofbiz/security/SecuredUpload.java 
b/framework/security/src/main/java/org/apache/ofbiz/security/SecuredUpload.java
index 6ee56e9a43..f1510da085 100644
--- 
a/framework/security/src/main/java/org/apache/ofbiz/security/SecuredUpload.java
+++ 
b/framework/security/src/main/java/org/apache/ofbiz/security/SecuredUpload.java
@@ -277,8 +277,8 @@ public class SecuredUpload {
                     || isValidCompressedFile(fileToCheck, delegator)
                     || isValidAudioFile(fileToCheck)
                     || isValidVideoFile(fileToCheck)
-                    || isValidCsvFile(fileToCheck)
-                    || isValidPdfFile(fileToCheck)) {
+                    || isValidPdfFile(fileToCheck)
+                    || isValidCsvFile(fileToCheck)) {
                 return true;
             }
             break;

Reply via email to