You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ingest trusts the OS extension table over file bytes when detecting MIME type #561
Docbank records a real JPEG as application/jpg on Windows when another program has rewritten the registry row for .jpg. Every feature that keys on the stored MIME type then treats the file as something other than an image.
Ingest resolves the type from the file extension first. It sniffs the bytes only when the extension is unknown, so a bad extension table wins over a valid JPEG header.
The photo asset work in #465 is the first feature to gate behavior on that type. On the affected machine a .jpg from a camera is refused as not eligible. A copy of the same bytes renamed .dng is enrolled.
Environment
Version v0.14.0-223-g92700038 on Windows 11. JPEGView writes Content Type = application/jpg under HKCR\.jpg when it claims the extension. Go's mime package loads that table at startup and lets it override the built-in list. Chrome and other browsers read the file header and are unaffected.
The listing shows "mime_type":"application/jpg" for the JPEG. Setting the registry value back to image/jpeg and re-adding the file restores image/jpeg.
Proposed fixes
Make the mimetype library the primary detector. It is already an indirect dependency, reads magic bytes for around 170 formats including DNG, CR2, NEF, and HEIC, and consults the extension only when the bytes are ambiguous. This fixes the registry case and gives the RAW slices under Roadmap: photos in Docbank #465 a detector that works on every platform.
Keep the extension as a tiebreaker and as the only source for formats the sniffer cannot recognize, such as .xmp sidecars.
Reject extension results that are not registered media types, such as application/jpg, and fall through to sniffing. This is a one-line guard that also catches other polluted rows.
Decide whether existing rows are rewritten. Vaults already carrying wrong types keep them until the file is added again, so the fix needs a migration or a maintenance command to re-detect stored files.
A smaller alternative is to sniff with the standard library first and fall back to the extension. That fixes JPEG, PNG, GIF, and WebP but leaves camera RAW dependent on the extension table, so it lost.
Activity
fix(ingest): detect MIME from recognized bytes first (kenn-io#561)
fix(ingest): retain extensions for content-guessed MIME types (kenn-i…
fix(ingest): detect MIME from recognized bytes first (kenn-io#561)
fix(ingest): use compatible MIME refinements after byte detection (#608)
rodboev commentedon Oct 16, 2026
Ingest now refines the MIME type from file bytes only with compatible types. Closing.