Skip to content

Commit 9659216

Browse files
committed
feat: add nullable places for content type
1 parent 81cf085 commit 9659216

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

android/src/main/kotlin/vn/hunghd/flutterdownloader/DownloadWorker.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ class DownloadWorker(context: Context, params: WorkerParameters) :
519519
* Create a file inside the Download folder using MediaStore API
520520
*/
521521
@RequiresApi(Build.VERSION_CODES.Q)
522-
private fun createFileInPublicDownloadsDir(filename: String?, mimeType: String): Uri? {
522+
private fun createFileInPublicDownloadsDir(filename: String?, mimeType: String?): Uri? {
523523
val collection: Uri = MediaStore.Downloads.EXTERNAL_CONTENT_URI
524524
val values = ContentValues()
525525
values.put(MediaStore.Downloads.DISPLAY_NAME, filename)
@@ -772,7 +772,7 @@ class DownloadWorker(context: Context, params: WorkerParameters) :
772772
return contentType?.split(";")?.toTypedArray()?.get(0)?.trim { it <= ' ' }
773773
}
774774

775-
private fun isImageOrVideoFile(contentType: String): Boolean {
775+
private fun isImageOrVideoFile(contentType: String?): Boolean {
776776
val newContentType = getContentTypeWithoutCharset(contentType)
777777
return newContentType != null && (newContentType.startsWith("image/") || newContentType.startsWith("video"))
778778
}

0 commit comments

Comments
 (0)