miguelpruivo / flutter_file_picker

File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.
MIT License
1.35k stars 673 forks source link

Select some classification files. The file name type suffix is missing #1042

Closed CanFor closed 2 years ago

CanFor commented 2 years ago

Select some classification files. The file name type suffix is missing

As shown below, I select an audio file.This is an audio file, the actual returned path and name are missing the file type suffix

var result = await FilePicker.platform.pickFiles(
  allowMultiple: true,
);
print('pickFiles==========');
print(result.toString());
print(result?.paths.toString());
print(result?.files.toString());

D/FilePickerDelegate(15528): Selected type */*
I/Timeline(15528): Timeline: Activity_launch_request time:1092926125 intent:Intent { act=android.intent.action.GET_CONTENT cat=[android.intent.category.OPENABLE] typ=*/* (has extras) }
W/System  (15528): A resource failed to call close. 
W/System  (15528): A resource failed to call close. 
I/FilePickerUtils(15528): Caching from URI: content://com.android.providers.media.documents/document/audio%3A4096
D/FilePickerUtils(15528): File loaded and cached at:/data/user/0/com.example.one_person/cache/file_picker/告白氣球
D/FilePickerDelegate(15528): File path:[com.mr.flutter.plugin.filepicker.FileInfo@8292ed7]
I/flutter (15528): pickFiles==========
I/flutter (15528): FilePickerResult(files: [PlatformFile(path /data/user/0/com.example.one_person/cache/file_picker/告白氣球, name: 告白氣球, bytes: null, readStream: null, size: 7735513)])
I/flutter (15528): [/data/user/0/com.example.one_person/cache/file_picker/告白氣球]
I/flutter (15528): [PlatformFile(path /data/user/0/com.example.one_person/cache/file_picker/告白氣球, name: 告白氣球, bytes: null, readStream: null, size: 7735513)]

Android Phone

https://user-images.githubusercontent.com/43408104/171380902-3fe4bf6d-ad44-4f15-a07b-bd960e6fcbe1.mp4

Plug in version: file_ picker: ^4.5.1

[✓] Flutter (Channel stable, 2.10.5, on macOS 12.3.1 21E258 darwin-arm, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
miguelpruivo commented 2 years ago

@CanFor the suffix is extracted from the file name and, for some reason, sometimes isn't available.

I'm sorry for any inconvenience but let me know if you find the reason why and I'll happy to fix it.