From 43398cdcd4da47e7e05a59908f9b1f93c624cc11 Mon Sep 17 00:00:00 2001 From: Thiago Carvalho Date: Fri, 27 Oct 2023 13:07:40 -0300 Subject: [PATCH 1/3] fix(drag and drop) - When using drag and drop the file path resolves to similar to: blob:http://localhost:54203/5628ef94-ffda-4c1e-981c-5decd535b579. Now, if the contentType is provided, the `formXFile` will use it. --- lib/src/io_file.dart | 3 ++- lib/src/utils/mime_type_utils.dart | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/io_file.dart b/lib/src/io_file.dart index b9bc28d..8ef393b 100644 --- a/lib/src/io_file.dart +++ b/lib/src/io_file.dart @@ -106,7 +106,8 @@ class IOFileAdapter { Future fromXFile(XFile file) async { final lastModified = await file.lastModified(); - final contentType = lookupMimeTypeWithDefaultType(file.path); + final contentType = + file.mimeType ?? lookupMimeTypeWithDefaultType(file.path); return _FromXFile( file, diff --git a/lib/src/utils/mime_type_utils.dart b/lib/src/utils/mime_type_utils.dart index 2f06052..40e17d7 100644 --- a/lib/src/utils/mime_type_utils.dart +++ b/lib/src/utils/mime_type_utils.dart @@ -14,6 +14,8 @@ String? lookupMimeType(String path, {List? headerBytes}) { return applicationGZip; } + print(path); + return mime.lookupMimeType(path, headerBytes: headerBytes); } From 2c14f590f1185430bc13a2760876851daeb67f72 Mon Sep 17 00:00:00 2001 From: Thiago Carvalho Date: Fri, 27 Oct 2023 13:15:01 -0300 Subject: [PATCH 2/3] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 1a21e1e..55339c7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ardrive_io description: A new Flutter package project. -version: 1.4.0 +version: 1.4.1 homepage: publish_to: none From 19616c9d8490db3a09b23292f36ee6480b7b7dc3 Mon Sep 17 00:00:00 2001 From: Thiago Carvalho Date: Fri, 27 Oct 2023 13:17:41 -0300 Subject: [PATCH 3/3] Update mime_type_utils.dart --- lib/src/utils/mime_type_utils.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/src/utils/mime_type_utils.dart b/lib/src/utils/mime_type_utils.dart index 40e17d7..2f06052 100644 --- a/lib/src/utils/mime_type_utils.dart +++ b/lib/src/utils/mime_type_utils.dart @@ -14,8 +14,6 @@ String? lookupMimeType(String path, {List? headerBytes}) { return applicationGZip; } - print(path); - return mime.lookupMimeType(path, headerBytes: headerBytes); }