Table of Contents

Class MaildirArchiveLayout

Namespace
MailFathom.Domain.Exports
Assembly
MailFathom.Domain.dll

Composes every path an exported archive holds, from names nothing in the archive may be led outside by.

public static class MaildirArchiveLayout
Inheritance
MaildirArchiveLayout
Inherited Members

Remarks

A folder name is untrusted text: a person typed it, or a remote server chose it. So no name reaches a path as it was written. The archive uses the Maildir++ layout — the inbox is the root Maildir and every other folder is one directory at the root named . followed by its path segments joined by . — and each segment is written as its UTF-8 bytes with every byte outside ASCII letters, digits, -, and _ percent-encoded. A segment of . or .. is therefore %2E or %2E%2E, no folder directory can be named cur, new, or tmp because every one of them begins with ., and a delimiter of any extractor's — a slash, a backslash, a control character — cannot appear literally. See ADR 0034.

A message's file name is minted here and takes nothing from the message or from its folder, which is the other half of the same rule: the only untrusted text an archive carries is inside a message file, where an extractor writes it nowhere.

Fields

KeywordsDocumentPath

The document at the archive root that carries the keywords Maildir file names have no form for.

Methods

EncodeSegment(string)

Writes one path segment so that nothing an extractor reads as structure survives in it.

FolderDirectory(IReadOnlyList<string>, bool)

Composes the directory one folder's Maildir sits at, relative to the archive root.

MessageFileName(DateTimeOffset, long, long, MaildirFlagSet)

Mints the file name one message is written under, carrying the flags Maildir has a form for.

MessagePath(string, string)

Composes the whole path one message is written at, inside its folder's Maildir.