Excel file upload with parentheses in name is failing upload to unix server

Hi All,

We are using Pega 8.4.x vrsion.

We have a screen to upload an excel file and we are using pxParseExcelFile to process the excel file.

Our server are in Unix servers.

When I upload a file which has parantheses in name [for example “Sample (2).xlsx” ], in Unix server folder file://web:/StaticContent/global/ServiceExport/, the file name saved as Sample$282$29..xlsx [The parantheses is replaced with $28 $29)

Due to this, I am getting "File not found exception and not able to upload the file.

Could anyone please help me how to fix this issue.

Appreciate your time and help.

Thanks in Advance

Sahul Vetcha

@Sahul this sounds like an issue with crossScriptingFilter to allow special characters in the attachment preview filename.

The behaviour looks like an expected one. This is because the cross-site scripting was applied in order to mitigate security attacks.
So, you can achieve this by adding a java step to decode the encoded attachment name. FYI : OOTB function to use to decode : StringUtils.decodeCrossOSString(encodedString);

Currently, there is no way to prevent file names containing parentheses from being changed to escaped characters when uploading files in Pega Platform. This is the expected behavior of the product. However, you can use the “pyMemo” property to get the unencoded file name, or create an activity to address the issue when transferring attachments via REST connector.

Special characters converted in attachments’ names (BUG-815507,BUG-815508,BUG-815509,BUG-815510)

Notes: Filename when have special characters and passed to REST service they are in form of encoded format, provided docs to help create activity that will address this issue but it addressed only for german characters but not for special characters.

That was logged as a future product enhancement: FDBK-102987: Special characters converted in attachments’ names

If you need further help with this, please log a support issue via the MSP and provide the INC id here.

Please have a look at the Pega Platform 8.4.6 Patch Resolved Issues for a similar fix:

NC-179683 664453 Handling added for decoding file names containing umlauts Two issues were seen with file names that contained an umlaut:
When sending file with an umlaut in the name via PegaCHAT, the error “Failed to load resource: the server responded with a status of 404 (404)” appeared on the Client side and a preview was generated. On the Agent side, the message was sent but attempting to open it resulted in an error that the file did not exist. This was traced to the unescape javascript API returning the wrong decoded values if the encoded value of an umlaut character was sent, and has been resolved by adding a safe check to avoid a malformed URI. Second, an image was not displayed in the Rich Text Editor if the image name contained the ä or Ä character in it. Investigation showed the activity parameters were being changed when it was invoked from the script. If the file name sent was “aysnÄ1626292145235.png” it was encoded to “aysn%C3%841626292145235.png” as expected, but when the parameter was passed to the Activity the value further changed to “aysn%C3%83%C2%841626292145235.png”, causing the file open failure because the names did not match. To resolve this, code has been added which will correctly decode the encoded values of umlaut characters.
User Exper
INC-178650 673550 Cross-site scripting protections updated Cross-site scripting protections have been updated around the DisplayAttachment function.

Case Management

Hi @MarijeSchillern,

Thank you so much for the detailed explanation. I understood that the issue is because of the Cross scripting.

But here, my scenario is processing the excel file. We have an Import button, on click of the button, a popup will appear for file selection from system. We can select an excel file from system and can submit the popup. Then, the rows in the excl file will be parsed and displayed in a Table layout on Pega UI.

On click of the submit button in popup, I am getting error message - “The uploaded file template could not be recognized…”

In the tracer step page, getting the error message “pzUnrecognizedFileTemplate” and FileNotFoundException in Pega logs.

On click of submit, we are invoking an activity to call the API activiy pxParseExcelFile.

In pxParseExcelFile activity Java step to parse the excel file. In this step I am getting the problem.

Could you please make me understand where should I use the OOTB StringUtils.decodeCrossOSString(encodedString).

Appreciate your time and help

Thank you,

Sahul

@Sahul as you are receiving product errors whilst implementing the functionality please log a support issue via the MSP and provide the INC id here.

Sure @MarijeSchillern.

Thanks again.