Skip to content

Add MIME type mappings for mobile app package formats#241

Merged
patrickdappollonio merged 5 commits intomasterfrom
apk-mime-type-fix
Mar 23, 2026
Merged

Add MIME type mappings for mobile app package formats#241
patrickdappollonio merged 5 commits intomasterfrom
apk-mime-type-fix

Conversation

@patrickdappollonio
Copy link
Copy Markdown
Owner

Summary

  • Adds explicit MIME type mappings for .apk, .xapk, .aab, and .ipa files
  • Fixes an issue where APK files served without the correct Content-Type header would be detected as application/zip (since APKs are ZIP archives internally), causing some Android devices (Onn, Android phones, Android TV) to append .zip to the downloaded filename, making the APK uninstallable

Test plan

  • Run go test ./internal/ctype/... to verify no regressions
  • Serve an .apk file and confirm the response Content-Type is application/vnd.android.package-archive
  • Download an APK on an Android device and verify no .zip extension is appended

The nolint annotations on individual lines handle these false positives
instead of blanket-excluding the rules project-wide.
The os.Open calls in serveFile and renderMarkdownFile operate on paths
derived from the serving root, not raw user input.
@patrickdappollonio patrickdappollonio merged commit 4bd871c into master Mar 23, 2026
2 checks passed
@patrickdappollonio patrickdappollonio deleted the apk-mime-type-fix branch March 23, 2026 03:52
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.

1 participant