Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android mime type not detected if file path contains whitespace #203

Open
BradenBagby opened this issue Oct 25, 2021 · 3 comments
Open

Android mime type not detected if file path contains whitespace #203

BradenBagby opened this issue Oct 25, 2021 · 3 comments
Assignees
Labels
android Android-only issues bug Something isn't working

Comments

@BradenBagby
Copy link

For example:
after compressing with video_compress (https://pub.dev/packages/video_compress) plugin, path could be:
'/storage/emulated/0/Android/data/com.example/files/video_compress/VID_2021-10-25 02-21-21.mp4'
which would be detected as mime type 'application/octet-stream' instead of 'video/mp4'

Debated on whether this is an issue with video_compress creating paths with whitespace, or flutter_uploader not accepting paths with whitespace. Decided this is a flutter_uploader issue. iOS works fine with whitespace

@ened ened self-assigned this Oct 29, 2021
@ened ened added android Android-only issues bug Something isn't working labels Oct 29, 2021
@mkobuolys
Copy link

Any updates on this? After the investigation, it seems that the method that causes the issue is private String GetMimeType(String url) in UploadWorker.java, specifically - String extension = MimeTypeMap.getFileExtensionFromUrl(url);. I assume this part returns null or empty string.

@cfsbhawkins
Copy link

It may be better to use something from okhttp like MimeUtils, the MimeTypeMap is not as exhaustive.

@ened
Copy link
Collaborator

ened commented Jan 20, 2022

@cfsbhawkins Could you prepare a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Android-only issues bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants