Skip to content

Commit

Permalink
fix(drag and drop)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
thiagocarvalhodev committed Oct 27, 2023
1 parent 487156d commit 43398cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/src/io_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ class IOFileAdapter {

Future<IOFile> fromXFile(XFile file) async {
final lastModified = await file.lastModified();
final contentType = lookupMimeTypeWithDefaultType(file.path);
final contentType =
file.mimeType ?? lookupMimeTypeWithDefaultType(file.path);

return _FromXFile(
file,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/utils/mime_type_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ String? lookupMimeType(String path, {List<int>? headerBytes}) {
return applicationGZip;
}

print(path);

return mime.lookupMimeType(path, headerBytes: headerBytes);
}

Expand Down

0 comments on commit 43398cd

Please sign in to comment.