Improve default mime type.

This commit is contained in:
Benoit Marty 2023-09-26 13:53:25 +02:00 committed by Benoit Marty
parent 34631f53b3
commit e7ba973e7b
2 changed files with 19 additions and 8 deletions

View file

@ -51,4 +51,12 @@ object MimeTypes {
fun String?.isMimeTypeFile() = this?.startsWith("file/").orFalse()
fun String?.isMimeTypeText() = this?.startsWith("text/").orFalse()
fun String?.isMimeTypeAny() = this?.startsWith("*/").orFalse()
fun fromFileExtension(fileExtension: String): String {
return when (fileExtension.lowercase()) {
"apk" -> Apk
"pdf" -> Pdf
else -> OctetStream
}
}
}