[jira] [Comment Edited] (OFBIZ-10746) Error while uploading file in Ecommerce Profile's File Manager

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Comment Edited] (OFBIZ-10746) Error while uploading file in Ecommerce Profile's File Manager

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-10746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17287855#comment-17287855 ]

Priya Sharma edited comment on OFBIZ-10746 at 2/21/21, 7:04 AM:
----------------------------------------------------------------

Hi guys, sorry for the delay, but here are my findings

UtilHttp method getParameterMap is responsible for fetching and populating the multiPartMap form fields on the request map, as per the following code block
{code:java}
        Map<String, Object> multiPartMap = params.isEmpty() ? getMultiPartParameterMap(req) : Collections.emptyMap();
        params.putAll(multiPartMap);
        req.setAttribute("multiPartMap", multiPartMap);
{code}
so it happens to be that once the params map has got values, the multiPartMap is initialized with an empty map and set on the request.

Thus it is no longer available to the target service after the "getParameterMap" is invoked multiple times before the service is executed.

I replaced this code with the following on my local machine and it worked to suffix the findings above.
{code:java}
Map<String, Object> multiPartMap = params.isEmpty() ? getMultiPartParameterMap(req) : Collections.emptyMap();
params.putAll(multiPartMap);
if (req.getAttribute("multiPartMap") == null) {
    req.setAttribute("multiPartMap", multiPartMap);
}
{code}
[~jleroux], could you please suggest if there is a better way to handle this, or any other problems that might be induced due to this change.


was (Author: priya.sharma.9362):
Hi guys, sorry for the delay, but here are my findings

UtilHttp method getParameterMap is responsible for fetching and populating the multiPartMap form fields on the request map, as per the following code block
{code:java}
        Map<String, Object> multiPartMap = params.isEmpty() ? getMultiPartParameterMap(req) : Collections.emptyMap();
        params.putAll(multiPartMap);
        req.setAttribute("multiPartMap", multiPartMap);
{code}
so it happens to be that once the params map has got values, the multiPartMap is initialized with an empty map and set on the request.

Thus it is no longer available to the target service after the "getParameterMap" is invoked multiple times before the service is executed.

I replaced this code with the following on my local machine and it worked to suffix the findings above.
{code:java}
Map<String, Object> multiPartMap = params.isEmpty() ? getMultiPartParameterMap(req) : Collections.emptyMap();
params.putAll(multiPartMap);
if (!multiPartMap.isEmpty()) {
    req.setAttribute("multiPartMap", multiPartMap);
}
{code}

[~jleroux], could you please suggest if there is a better way to handle this, or any other problems that might be induced due to this change.

> Error while uploading file in Ecommerce Profile's File Manager
> ---------------------------------------------------------------
>
>                 Key: OFBIZ-10746
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10746
>             Project: OFBiz
>          Issue Type: Bug
>          Components: ecommerce
>    Affects Versions: Trunk
>            Reporter: Aishwary Shrivastava
>            Assignee: Priya Sharma
>            Priority: Major
>         Attachments: ErroUploadingFileOnFileManagerEcommerce.png
>
>
> On uploading File in Ecommerce Profile's File Manager,
> "The following required parameter is missing: [IN] [uploadPartyContentFile.partyContentTypeId]" error is displaying.
>  
> Steps to regenerate the issue:
>  # Open Ecommerce on Ofbiz.
>  # Login with any user.
>  # Go to Profile.
>  # Navigate down to File Manager.
>  # Select Purpose.
>  # Seletct Mime Type
>  # Click upload.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)