diff --git a/FileTypes/src/main/java/com/infomaniak/library/filetypes/FileType.kt b/FileTypes/src/main/java/com/infomaniak/library/filetypes/FileType.kt index 6caf08b2c..18b054feb 100644 --- a/FileTypes/src/main/java/com/infomaniak/library/filetypes/FileType.kt +++ b/FileTypes/src/main/java/com/infomaniak/library/filetypes/FileType.kt @@ -46,14 +46,15 @@ enum class FileType(val icon: ImageVector, private val colorLight: Color, privat } companion object { - fun getMimeTypeFromFileName(fileName: String): String? { + //TODO Move this method into Core2 + fun guessMimeTypeFromFileName(fileName: String): String? { return fileName.extractExtension()?.let { extension -> MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension) } } fun guessFromFileName(fileName: String): FileType { - val mimeType = getMimeTypeFromFileName(fileName) ?: return UNKNOWN + val mimeType = guessMimeTypeFromFileName(fileName) ?: return UNKNOWN return guessFromMimeType(mimeType) } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportationFilesManager.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportationFilesManager.kt index 4041cc999..e7e408506 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportationFilesManager.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportationFilesManager.kt @@ -104,7 +104,7 @@ class ImportationFilesManager @Inject constructor( uid = fileToImport.fileName, fileName = fileToImport.fileName, fileSize = fileToImport.fileSizeInBytes, - mimeType = FileType.getMimeTypeFromFileName(fileToImport.fileName), + mimeType = FileType.guessMimeTypeFromFileName(fileToImport.fileName), localPath = copiedFile.toUri().toString(), ) )