Table of Contents

Struct AttachmentFileName

Namespace
MailFathom.Domain.Emails
Assembly
MailFathom.Domain.dll

Holds an attachment file name that is safe to store, display, and log a decision about.

public readonly record struct AttachmentFileName : IEquatable<AttachmentFileName>
Implements
Inherited Members

Remarks

A file name is attacker-controlled content, not a label. After the transport encodings are decoded it can carry path separators and traversal segments, control characters and line breaks, unbounded length, and bidirectional overrides that make a name render as something other than what it is. Normalization happens once, here, so no consumer has to remember which of those a name it was handed still contains.

WasNormalized exists so a caller can tell a plain name from a repaired one. A name that survives unchanged is the ordinary case and must stay distinguishable from one this type had to rewrite.

Fields

MaxLength

The greatest number of characters a normalized file name keeps.

Properties

Value

Gets the normalized name, which is never blank and never carries path structure.

WasNormalized

Gets whether normalization changed what the message wrote.

Methods

ToString()

Returns the fully qualified type name of this instance.

TryNormalize(string?, out AttachmentFileName)

Normalizes a decoded file name into one that is safe to keep.