Repository navigation
[image_picker_ios] Return an error for undecodable image data - #12267
auto-submit[bot] merged 7 commits into
Conversation
PHPicker can provide image-conforming data that UIImage cannot decode. Complete the save operation with invalid_image instead of passing a nil image to the save path.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request updates the iOS implementation of the image_picker plugin to handle cases where selected image data cannot be decoded. In FLTPHPickerSaveImageToPathOperation.m, a check has been added to verify if the UIImage is nil after initialization; if so, the operation completes with an 'invalid_image' FlutterError. A corresponding unit test has been added to PickerSaveImageToPathOperationTests.m to verify this behavior, and the package version has been bumped to 0.8.13+7 in both pubspec.yaml and CHANGELOG.md. There are no review comments to address.
|
This pull request is not mergeable in its current state, likely because of a merge conflict. Pre-submit CI jobs were not triggered. Pushing a new commit to this branch that resolves the issue will result in pre-submit jobs being scheduled. |
|
@TeddyYeung could you resolve the merge conflicts? |
Merge current upstream main and retain both the upstream PHPicker operation tests and the AVIF decoding regression test from this PR. Constraint: Upstream added independent tests at the same insertion point. Rejected: Prefer either side wholesale | would discard valid regression coverage. Confidence: high Scope-risk: narrow Directive: Keep the undecodable-image assertion when updating this test fixture. Tested: flutter_plugin_tools format; dart analyze Not-tested: iOS native tests and Xcode analysis (full Xcode/simctl unavailable)
|
Resolved in af0badc. I merged the current upstream main and retained both the upstream PHPicker operation coverage and this PR's undecodable-image regression test. Formatting and Dart analysis pass; the iOS native test suite could not run locally because this environment does not have Xcode/simctl installed. |
|
The merge conflicts have been resolved. Could you please re-add the |
|
autosubmit label was removed for flutter/packages/12267, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
Hi @TeddyYeung - it looks like you force pushed with an account that you didn't sign the CLA with. You will need to amend the commit locally with the correct email address and then force push before we can take a look again. Thank you! |
d226208 to
0707379
Compare
…ios-avif-completion
The fix was listed under 0.8.13+7, which has already been published.
|
Hi @elliette, thanks! The commit authors are now fixed and |
|
@TeddyYeung apologies -- do you mind resolving the merge conflicts on this one then we'll get right back to it. |
- Bump image_picker_ios to 0.8.13+10 (0.8.13+9 was taken upstream) - Port undecodable image test to Swift Testing after ObjC tests were migrated
|
Thanks @cbracken! Merged the latest main and resolved the conflicts in bb0d0c3:
Could you re-add the |
flutter/packages@7660d46...54706bd 2026-10-08 [email protected] [image_picker_ios] Return an error for undecodable image data (flutter/packages#12267) 2026-10-07 [email protected] [flutter shaders] update min flutter version (flutter/packages#13160) 2026-10-07 [email protected] Import flutter_shaders package (flutter/packages#12583) 2026-10-07 [email protected] [material_ui] Migrate M3 Typography template to use new gen_defaults (flutter/packages#13074) 2026-10-07 [email protected] Sync release-material_ui-1.6.0 to main (flutter/packages#13149) 2026-10-07 [email protected] [pigeon] Fix native interop (JNI) calls in minified Android release builds (flutter/packages#13151) 2026-10-06 [email protected] [material_ui] Migrate ListTile and SwitchListTile API doc snippets to {@example} (batch 10) (flutter/packages#13097) 2026-10-06 [email protected] Sync release-cupertino_ui-1.1.2 to main (flutter/packages#13150) 2026-10-06 [email protected] [material_ui] Fix `TabBar` assertion to allow `indicatorWeight: 0` with a themed `indicator` (flutter/packages#12696) 2026-10-06 [email protected] [material_ui] Fix time picker input validation for 24-hour locales (flutter/packages#13033) 2026-10-06 [email protected] [material_ui] Migrate Checkbox, CheckboxListTile, Radio, and RadioListTile API doc snippets to {@example} (batch 9) (flutter/packages#13112) 2026-10-06 [email protected] [quick_actions_android] Return null from getLaunchAction when no activity is attached (flutter/packages#12331) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Resolves conflicts with flutter#12267, flutter#13079, and flutter#13224: - Moves this change to 0.8.13+13, above main's 0.8.13+12 entry. - Keeps main's removal of the kUTTypeGIF fallback in the GIF writer and this change's NULL destination check. - Ports the two UIImagePickerController save-failure tests to the Swift plugin tests, using the PHImageManager seam instead of OCMock. - Replaces the undecodable-data PHPicker test, which flutter#12267 now rejects earlier, with one that reaches the save failure through maxWidth 0. - Drops the test bridging header, which main removed: the test subclass now replaces +temporaryFilePath: by selector, and the GIF destination test goes through the public save method.
flutter/packages@7660d46...54706bd 2026-10-08 [email protected] [image_picker_ios] Return an error for undecodable image data (flutter/packages#12267) 2026-10-07 [email protected] [flutter shaders] update min flutter version (flutter/packages#13160) 2026-10-07 [email protected] Import flutter_shaders package (flutter/packages#12583) 2026-10-07 [email protected] [material_ui] Migrate M3 Typography template to use new gen_defaults (flutter/packages#13074) 2026-10-07 [email protected] Sync release-material_ui-1.6.0 to main (flutter/packages#13149) 2026-10-07 [email protected] [pigeon] Fix native interop (JNI) calls in minified Android release builds (flutter/packages#13151) 2026-10-06 [email protected] [material_ui] Migrate ListTile and SwitchListTile API doc snippets to {@example} (batch 10) (flutter/packages#13097) 2026-10-06 [email protected] Sync release-cupertino_ui-1.1.2 to main (flutter/packages#13150) 2026-10-06 [email protected] [material_ui] Fix `TabBar` assertion to allow `indicatorWeight: 0` with a themed `indicator` (flutter/packages#12696) 2026-10-06 [email protected] [material_ui] Fix time picker input validation for 24-hour locales (flutter/packages#13033) 2026-10-06 [email protected] [material_ui] Migrate Checkbox, CheckboxListTile, Radio, and RadioListTile API doc snippets to {@example} (batch 9) (flutter/packages#13112) 2026-10-06 [email protected] [quick_actions_android] Return null from getLaunchAction when no activity is attached (flutter/packages#12331) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
PHPickercan provide data for a type that conforms toUTTypeImageeven whenUIImagecannot decode the bytes. The linked issue reports this with an AVIF selection. The existing path continues with anilimage and can treat the selection as successfully saved.This change completes the operation with the existing
invalid_imageerror when decoding fails. It also adds a regression test that verifies the callback returns no path and that theNSOperationfinishes.Fixes flutter/flutter#132154
No public API documentation changes are needed because this uses the existing image-picker error contract.
Tests run:
flutter_plugin_tools format --packages image_picker_ios --fail-on-changeflutter_plugin_tools analyze --ios --packages image_picker_iosflutter_plugin_tools dart-test --packages image_picker_iosflutter_plugin_tools native-test --ios --no-integration --packages image_picker_iosflutter_plugin_tools validate --packages image_picker_iosflutter_plugin_tools license-check(from packages/image_picker/image_picker_ios) dart pub publish --dry-runPre-Review Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2