Attachment Dropping: Failure to Decode File Names Properly During Mail Fetching

Attachment Dropping: Failure to Decode File Names Properly During Mail Fetching

Issue:
      The attachment is dropped due to invalid extension. 

Issue ID : SD-118194

 After decoding, the file name appears as:

Orange Załącznik nr 1 - Podsumowanie - uzupełnienie. xlsx(Contains space in the extension)

However, the actual file name should be:

Orange Załącznik nr 1 - Podsumowanie - uzupełnienie.xlsx

The issue arises because there is an extra space character in the extension after decoding from the email. As a result, the extension of the attachment is considered as invalid and discards it.

ErrorTrace:
[10:10:37:643]|[01-24-2024]|[com.adventnet.iam.security.SecurityRequestWrapper]|[SEVERE]|[273]: File extension do not match with the allowed extenions |
[10:10:37:643]|[01-24-2024]|[com.adventnet.iam.security.IAMSecurityException]|[INFO]|[273]: IAMSecurityException ErrorCode: INVALID_FILE_EXTENSION|
[10:10:37:643]|[01-24-2024]|[com.manageengine.servicedesk.v3api.utils.AttachmentAPIUtil]|[SEVERE]|[273]: Exception while writing Attachment file| 
com.adventnet.iam.security.IAMSecurityException: INVALID_FILE_EXTENSION
at com.adventnet.iam.security.UploadFileRule.validateFile(UploadFileRule.java:373)
at com.adventnet.iam.security.SecurityUtil.validateFile(SecurityUtil.java:2612)
at com.adventnet.iam.security.SecurityUtil.validateFileViaApiAndReturnResult(SecurityUtil.java:2596)
at com.adventnet.iam.security.SecurityUtil.validateFileViaApi(SecurityUtil.java:2591)
at com.manageengine.servicedesk.v3api.utils.AttachmentAPIUtil.uploadStreamAsAttachment(AttachmentAPIUtil.java:1596)
at com.manageengine.servicedesk.mailutils.MailAPI.uploadAttachment(MailAPI.java:2847)
at com.manageengine.servicedesk.mailutils.ModuleHandler.handleMailObject(ModuleHandler.java:111)
at com.adventnet.servicedesk.mailutils.MailProcessor.processEMail(MailProcessor.java:71)
at com.manageengine.servicedesk.mail.core.fetcher.EwsMailFetcher.fetchAndProcessMails(EwsMailFetcher.java:159)
at com.manageengine.servicedesk.mail.core.fetcher.MailFetcher.startFetching(MailFetcher.java:306)
at com.adventnet.servicedesk.helpdesk.mail.task.MailFetchingTask.executeTask(MailFetchingTask.java:39)
at com.adventnet.taskengine.internal.SchedulerBean.executeTask(SchedulerBean.java:641)
at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.adventnet.mfw.bean.BeanProxy.lambda$invoke$0(BeanProxy.java:51)
at com.zoho.mickey.api.DefaultCodeBlock.execute(CodeBlock.java:453)
at com.adventnet.mfw.bean.BeanProxy.invoke(BeanProxy.java:48)
at com.sun.proxy.$Proxy5.executeTask(Unknown Source)
at com.adventnet.taskengine.internal.ScheduleExecutor.executeNextTask(ScheduleExecutor.java:334)
at com.adventnet.taskengine.internal.ScheduleExecutor.run(ScheduleExecutor.java:225)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)

[10:10:37:643]|[01-24-2024]|[com.manageengine.servicedesk.mailutils.MailAPI]|[INFO]|[273]: Attchment dropped due to : INVALID_FILE_EXTENSION


Fix:
Apply the provided fixed JAR file to address the issue. This solution, outlined in the knowledge base, ensures correct filename decoding, enabling successful addition of the attachment.


Note:
Before applying the .fjar file, kindly verify its compatibility in the "Jar Compatibility" section below.


Steps to apply the fix:
1. Download the attached .fjar file.
2. Click here for steps to apply the .fjar file.
3. Restart the application service.
4. If the issue occurs again, enable the email debug in the application, recreate the issue after enabling the email debug then immediately zip the logs (<server_home>\logs folder. For eg: C:\Program Files\ManageEngine\ServiceDesk\logs folder) and share it with us for analysis. If the size of the log file is huge, you can send it to us using our FTP link https://bonitas2.zohocorp.com/. Select the product as "ServiceDesk Plus" and provide the proper ticket number.


Jar Compatibility:

Build
Compatible Jar
14500
14500_Attachment_name_decode.fjar
14503 & 14504
14504_9636989_Attachment_name_decode.fjar
14506 & 14600
14506_9560318_Attachment_name_decode.fjar
14620-14630
14630_10381618.fjar

                  New to ADSelfService Plus?