handle files declared as .apk as .apk.

This commit is contained in:
fiatjaf
2025-06-03 19:01:18 -03:00
parent 28f85c9ea3
commit 7a1292b58b
2 changed files with 7 additions and 0 deletions

View File

@@ -91,6 +91,11 @@ func (bs BlossomServer) handleUpload(w http.ResponseWriter, r *http.Request) {
ext = getExtension(mimetype)
}
// special case of android apk -- if we see a .zip but they say it's .apk we trust them
if ext == ".zip" && getExtension(r.Header.Get("Content-Type")) == ".apk" {
ext = ".apk"
}
// run the reject hooks
if nil != bs.RejectUpload {
reject, reason, code := bs.RejectUpload(r.Context(), auth, size, ext)

View File

@@ -26,6 +26,8 @@ func getExtension(mimetype string) string {
return ".webp"
case "video/mp4":
return ".mp4"
case "application/vnd.android.package-archive":
return ".apk"
}
exts, _ := mime.ExtensionsByType(mimetype)