Skip to content

Fall back to content-based MIME detection via puremagic#204

Merged
lavr merged 4 commits intomasterfrom
fix/issue-163-mime-type-detection
Mar 31, 2026
Merged

Fall back to content-based MIME detection via puremagic#204
lavr merged 4 commits intomasterfrom
fix/issue-163-mime-type-detection

Conversation

@lavr
Copy link
Copy Markdown
Owner

@lavr lavr commented Mar 31, 2026

Summary

  • When file extension is missing or unrecognized, detect MIME type from file content using magic bytes via puremagic
  • Extension-based detection still takes priority
  • Falls back to application/unknown if neither method works
  • Added puremagic to base dependencies

Closes #163

Test plan

  • All 87 tests pass locally
  • New tests: PNG bytes without extension, JPEG bytes without extension, unknown bytes fallback, extension priority over content

@lavr lavr merged commit cab27c8 into master Mar 31, 2026
10 checks passed
@lavr lavr deleted the fix/issue-163-mime-type-detection branch April 2, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mime_type detection only works by file extension

1 participant