Skip to content

Better ContentType.Name validaiton on composed values #128637

@mrek-msft

Description

@mrek-msft

System.Net.Mail.Attachment (and likely AlternateView) has ContentType property which has Name property which itself has validation based on MimeBasePart.DecodeEncoding used in setter, however if encoding is detected at the beginning of string, it do not validate rest of it, allowing to interfere with other parts MailMessage/Attachment/AlternateView. For example, following code sent attachment with name foo.txt instead of test.txt as specified in constructor param.

var at = new Attachment("test.txt");
at.ContentType.Name = "=?utf-8?Q?foo\"; filename=\"foo.txt\"";

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions