FA-76457 / Email MIME structure / Member archive
Resolve and de-duplicate attachment file names: last extension suffix · case 02
The copy counter is inserted before the first dot, splitting multi-part extensions differently from the contract.
Case contract
Each part has optional fstar (already decoded filename*), fname (filename) and ctname (Content-Type name) and a type. Precedence is fstar, fname, ctname. Directory components are removed (both "/" and "\" separate). An empty name, "." or ".." becomes "attachment" plus an extension by type (.pdf, .png, .txt, else .bin). Names are de-duplicated case-insensitively: the k-th copy gets " (k)" before the last extension, or at the end when there is no extension or the name starts with its only dot.
Why this case matters
Attachment names end up on disk; wrong names overwrite files, leak paths or confuse users.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| multi-dot duplicate | ["archive.tar.gz", "archive (2).tar.gz"] | ["archive.tar.gz", "archive.tar (2).gz"] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗