Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[image_picker] Implemented 2860 and added Unit Test to test functionality #3685

Merged
merged 10 commits into from
Mar 10, 2021

Conversation

danielroek
Copy link
Contributor

@danielroek danielroek commented Mar 5, 2021

Fixes an issue where videos could be wrongly picked with .jpg extension.

Description

When picking videos on Android devices, it will return file names ended with .jpg extension, regardless of the file being actually a video. This requires a workaround implementation, such as opening a File descriptor on Flutter side and rename it to .mp4 again.

The issue happens because some URI paths doesn't have an extension and it was being extracted just by splitting the file name from . and getting the last part, which make it not quite reliable for some scenarios. Right now, I've updated the source to retrieve the extension based on the URI content.

As a note, this doesn't happen with all Android devices, but I can see it easily replicable with Samsung phones.

Related issues

Fixes #52419
Same implementation as #2860, but with the requested unit test

Pre-launch Checklist

  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@danielroek danielroek requested a review from cyanglaz as a code owner March 5, 2021 14:24
@google-cla google-cla bot added the cla: yes label Mar 5, 2021
@danielroek danielroek changed the title Implemented 2860 and added Unit Test to test functionality [image_picker] Implemented 2860 and added Unit Test to test functionality Mar 5, 2021
@danielroek danielroek marked this pull request as draft March 5, 2021 14:25
@frankyvij
Copy link

@cyanglaz : can you please review and publish the new version?

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! thanks for fixing it and providing tests :)

@cyanglaz
Copy link
Contributor

cyanglaz commented Mar 9, 2021

ci seems failed, could you try to re-base master

@danielroek
Copy link
Contributor Author

@cyanglaz CI is successful now :)

@cyanglaz cyanglaz added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Mar 10, 2021
@fluttergithubbot fluttergithubbot merged commit 735e1a5 into flutter:master Mar 10, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2021
fluttergithubbot pushed a commit to flutter/flutter that referenced this pull request Mar 10, 2021
@mvanbeusekom mvanbeusekom deleted the fix_2860 branch March 16, 2021 10:00
yasargil added a commit to yasargil/plugins that referenced this pull request Mar 18, 2021
* master: (49 commits)
  Prep for alignment with Flutter analysis options (flutter#3703)
  [google_maps_flutter_platform_interface] Mark constructors as const for ids (flutter#3718)
  [image_picker] Endorse image_picker_for_web (flutter#3717)
  Add missing licenses, and add a check (flutter#3720)
  [ci] Add libgcrypt to Docker image. (flutter#3711)
  Reorder the checkboxes in the PR template (flutter#3666)
  Re-endorse connectivity_for_web (flutter#3708)
  Fix missing declaration of windows' default_package (flutter#3705)
  Typos in comments (flutter#2846)
  Skip flutter upgrade for pod linting Cirrus task (flutter#3700)
  [cross_file] Delete. (flutter#3698)
  [tool] Improve check version ci so that it enforces the version in CHANGELOG and pubspec matches. (flutter#3678)
  Streamline CI setup, and reenable macOS credits (flutter#3697)
  [video_player] fixed misleading size and aspect ratio documentation (flutter#3668)
  [image_picker] Implemented 2860 and added Unit Test to test functionality (flutter#3685)
  [shared_preferences] Fix concurrent modification of the shared preferences on Android (flutter#3684)
  [extension_google_sign_in_as_googleapis_auth] Deleted. (flutter#3694)
  Skip pod lint tests (flutter#3692)
  [Video_Player] Remove the deprecated API reference. (flutter#3669)
  [google_sign_in] fix test(flutter#3690)
  ...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes p: image_picker platform-android waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[image_picker] image_picker returns .jpg extension when picking Video or GIF
5 participants