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

bug: Selecting single image from samsung gallery does not work with a multiple input field #6758

Closed
theigl opened this issue Jul 21, 2023 · 7 comments · Fixed by #6778
Closed
Labels
platform: android type: bug A confirmed bug report

Comments

@theigl
Copy link

theigl commented Jul 21, 2023

Bug Report

Capacitor Version

💊   Capacitor Doctor  💊

Latest Dependencies:

  @capacitor/cli: 5.1.0
  @capacitor/core: 5.1.0
  @capacitor/android: 5.1.0
  @capacitor/ios: 5.1.0

Installed Dependencies:

  @capacitor/cli: 4.8.0
  @capacitor/core: 4.8.0
  @capacitor/android: 4.8.0
  @capacitor/ios: 4.8.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

Platform(s)

Android

Current Behavior

When you have a <input multiple> field and select a single image from the Android Gallery, the input field does not receive any data. It works fine when multiple images are selected or when selecting a single image from any other source.

We debugged the issue and found the root cause here:

If we change the condition to > 0, then the input field behaves as expected.

Expected Behavior

It should be possible to select a single image from the Android Gallery when using a multiple input field.

Code Reproduction

Reproducer: https://github.com/divatzk/capacitor-file-upload-test

The reproducer contains only one page with a single and a multiple input field. To reproduce the issue, click on the multiple input field and select a single image from the Gallery. Nothing happens in this case. If you select 2 or more images, it works.

Note: This is the same as #6710 which was closed by the bot even though it had a reproducer.

@jcesarmobile
Copy link
Member

I can't reproduce.
In which devices and Android versions are you testing?

@jcesarmobile jcesarmobile added the needs reply needs reply from the user label Jul 24, 2023
@theigl
Copy link
Author

theigl commented Jul 25, 2023

We just realized we only tested this on Samsung devices and the app in question is the "Samsung Gallery" and not the default Android gallery. This might be an issue with Samsung devices only. There is another bug report that is also about Samsung device.

@Ionitron Ionitron removed the needs reply needs reply from the user label Jul 25, 2023
@jcesarmobile
Copy link
Member

What's the Android version of the Samsung devices you tested?
I don't have any, but I've tested several in browserstack and it worked in all of them. So could be related to the Samsung Gallery app version.

On the other hand, removing the item count check doesn't seem to break the input file for other devices, so we could probably delete it if it causes problems with some vendors/apps, I still have to do more intensive checking in more devices with different Android versions.

The truth is WebChromeClient.FileChooserParams.parseResult should handle the result, but it wasn't working when the user choose more than 1 item and that's why we added that if, to handle the returned elements ourselves, ideally google should fix the WebChromeClient.FileChooserParams.parseResult, and that's why the check is > 1 and not > 0.

@jcesarmobile jcesarmobile added the type: bug A confirmed bug report label Jul 28, 2023
@ionitron-bot
Copy link

ionitron-bot bot commented Jul 28, 2023

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

@jcesarmobile jcesarmobile changed the title bug: Selecting single image from Android gallery does not work with a multiple input field bug: Selecting single image from samsung gallery does not work with a multiple input field Jul 28, 2023
@jcesarmobile
Copy link
Member

I was able to reproduce on a galaxy M device from browserstack when using samsung gallery app and I have verified that removing the file count check doesn't break on any of my other devices.

@sahilrajput03
Copy link

Thanks for fixing this issue! Me at my company were having bad time finding the reason for this issue. Thanks Capacitor team!

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 13, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: android type: bug A confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants