Hi,
We are getting exceptions when processing email attachments that filenames contain double single quotes at the end (test’’.txt). The exception occurs when the Attachment.Name setter is invoked. The StackTrace appears to indicate the offending filename is resulting in an attempted to find the strings encoding. Double single quotes in the middle of the filename do not cause the exception. Apose.Email for .NET 4.0 version 17.1.0.0.
scrubbedName = FileAndPathNameIllegalCharUtility.CreateSafeFileName(att.Name, out scrubbedName, scrubOptions);
if (scrubbedName.IsNotNullOrEmpty())
{
att.Name = scrubbedName; //Exception here
//Good attachment name add to a list for processing
attachments.Add(att);
}
Characters removed by CreateSafeFileName (URI_ILLEGAL_CHARS = { ‘@’, ‘"’, ‘$’, ‘&’, ‘:’, ‘<’, ‘>’, ‘{’, ‘}’, ‘[’, ‘]’,
‘#’, ‘%’, ‘/’, ‘;’, ‘=’, ‘?’, ‘\’, ‘^’, ‘|’, ‘~’, ‘’’, ‘"’ };
StackTrace-
at
System.Globalization.EncodingTable.internalGetCodePageFromName(String name)<o:p></o:p>
at
System.Globalization.EncodingTable.GetCodePageFromName(String name)<o:p></o:p>
at
System.Text.Encoding.GetEncoding(String name)<o:p></o:p>
at
#=q_60aBNxG2$SuXCZfZj8RxMuQ4QvMCxRRNzSjx5tNaig=.#=qMYQy_hVHueJdS6Pxw7GcW6PqRwLc9ouD2xur1bMlMIg=(String
#=qRIDVWGAM$0BkCBJQsYmZAw==)<o:p></o:p>
at
Aspose.Email.Mime.ContentDisposition.get_FileName()<o:p></o:p>
at
Aspose.Email.Mail.Attachment.#=qjNb7XloW0J8_3iKnFFn9wvb23aHjAydf$MMzPynAANM=(Boolean&
#=qJg7wl47f7hGQvPeIF4FbAsdWdbO_jXQy7EOPmbLH5wM=)<o:p></o:p>
at
Aspose.Email.Mail.Attachment.#=qKmpcowkezBlTXeK44UnmdLVLTH_u7dGPaJWEJTJIVBQ=(String
#=q7G9LZy5KsRJ$RaSgKMwaRg==)<o:p></o:p>
at
Aspose.Email.Mail.Attachment.set_Name(String value)<o:p></o:p>
at
Hyland.Core.SubscriptionServer.Module.CheckForAttachment(MailMessage message,
List`1 attachments, IllegalCharacterScrubOptions scrubOptions) in
M:\TFS\DEV\Core\OnBase.NET\Libraries\Hyland.Core\SubscriptionServer\Module.cs:line
1313<o:p></o:p>
Thank you,
Cameron