Fix: Mail fetching stops due to invalid characters in the attachment name

Fix: Mail fetching stops due to invalid characters in the attachment name

Issue:

Mail fetching being stopped due to invalid characters "?" , ":" in the filename. In this case, the eml file's subject contains ":" character and so, while uploading the .eml as attachment, error is thrown (Only in windows server)

Trace:

[00:49:53:547]|[01-31-2024]|[com.manageengine.servicedesk.v3api.utils.AttachmentAPIUtil]|[SEVERE]|[383]: Exception while writing Attachment file| 
java.nio.file.InvalidPathException: Illegal char <?> at index 73: C:\Users\admin\AppData\Local\Temp\2\SDPAttachment\a9fb54f26e\Testing _ _ ? : characters.eml
at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at java.io.File.toPath(File.java:2273)
at com.manageengine.servicedesk.v3api.utils.AttachmentAPIUtil.uploadStreamAsAttachment(AttachmentAPIUtil.java:1594)
at com.manageengine.servicedesk.mailutils.MailAPI.uploadAttachment(MailAPI.java:2851)
at com.manageengine.servicedesk.mailutils.ModuleHandler.handleMailObject(ModuleHandler.java:107)
at com.adventnet.servicedesk.mailutils.MailProcessor.processEMail(MailProcessor.java:71)
at com.manageengine.servicedesk.mail.core.fetcher.JavaMailFetcher.fetchAndProcessMails(JavaMailFetcher.java:209)
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:698)
at sun.reflect.GeneratedMethodAccessor85.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:682)
at com.adventnet.mfw.bean.BeanProxy.invoke(BeanProxy.java:48)
at com.sun.proxy.$Proxy2.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)

[00:49:53:548]|[01-31-2024]|[com.manageengine.servicedesk.mail.core.MailScheduleBean]|[INFO]|[383]: __errormail__ : Error Mail is encountered for the first time. Skipping it to process again|

Fix:

     SDP now replaces the problematic characters "?", ":" with "_" character. With this, the attachment will be uploaded properly.

Steps to apply the fix:

1. Download the fjar file compatible to your build version. Check the compatibility in the below table.

2. Click here on steps to apply the fjar file.

3. Restart the application service.

4. Check for the issue.

5. If the issue occurs, 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.


Affected versions: Since 14610

Issue ID: SD-118369 (released in 14710 build)


Compatible Fjar files:


Build
Fjar name
14610-14630
14610_9573341.fjar

14700
14700_9670828.fjar

                  New to ADSelfService Plus?