diff --git a/utils/common/src/commonMain/kotlin/com/insanusmokrassar/postssystem/utils/common/KnownMimeTypes.kt b/utils/common/src/commonMain/kotlin/com/insanusmokrassar/postssystem/utils/common/KnownMimeTypes.kt index 233dea2f..cedd2f51 100644 --- a/utils/common/src/commonMain/kotlin/com/insanusmokrassar/postssystem/utils/common/KnownMimeTypes.kt +++ b/utils/common/src/commonMain/kotlin/com/insanusmokrassar/postssystem/utils/common/KnownMimeTypes.kt @@ -8,8 +8,6 @@ interface MimeType { } data class CustomMimeType(override val raw: String) : MimeType -private const val imageMainType = "image" - sealed class KnownMimeTypes(override val raw: String) : MimeType { object Any : MimeType, KnownMimeTypes("*/*") sealed class Application(raw: String) : MimeType, KnownMimeTypes(raw) { @@ -1437,6 +1435,10 @@ internal val knownMimeTypes: Set = setOf( KnownMimeTypes.XConference.XCooltalk, ) -fun findBuiltinMimeType(from: String): MimeType? { - return knownMimeTypes.firstOrNull { it.raw == from } +val knownMimeTypesMap by lazy { + knownMimeTypes.associateBy { it.raw } +} + +fun findBuiltinMimeType(from: String): MimeType? { + return knownMimeTypesMap[from] }