fun getContentType()

in azure-storage-common/src/main/kotlin/jetbrains/buildServer/serverSide/artifacts/azure/AzureUtils.kt [113:128]


    fun getContentType(file: File): String {
        URLConnection.guessContentTypeFromName(file.name)?.let {
            return it
        }
        if (probeContentTypeMethod != null && fileToPathMethod != null) {
            try {
                probeContentTypeMethod.invoke(null, fileToPathMethod.invoke(file))?.let {
                    if (it is String) {
                        return it
                    }
                }
            } catch (ignored: Exception) {
            }
        }
        return DEFAULT_CONTENT_TYPE
    }