ADR 0011: Normalize MIME Type Resolution via MimeHelper

Status

Accepted — 2025-12-15

Context

Content-type (Content-Type) influences behaviour across providers and integrations, so we need one consistent, predictable MIME rule across the repository.

Different providers and platforms handle MIME detection differently, so we want one consistent rule.

Problem

If each provider (or each integration surface) implements its own MIME resolution logic:

Decision

All MIME lookups flow through ManagedCode.MimeTypes.MimeHelper:

flowchart LR
  Input[FileName / Extension / Text] --> Base[BaseStorage]
  Base --> Mime[MimeHelper]
  Mime --> Opts[UploadOptions.MimeType]
  Opts --> Provider[Provider upload]

Alternatives Considered

  1. Per-provider MIME detection
    • Pros: providers can tailor behaviour to SDK capabilities.
    • Cons: inconsistent metadata; duplicated logic.
  2. Use framework-only helpers (FileExtensionContentTypeProvider, etc.)
    • Pros: common in ASP.NET.
    • Cons: not always available/consistent in all target contexts; would duplicate logic already present in ManagedCode.MimeTypes.
  3. Centralize on MimeHelper (chosen)
    • Pros: one rule for the entire repo; consistent content-type handling.
    • Cons: requires discipline to avoid adding ad-hoc helpers.

Consequences

Positive

Negative

References (Internal)