Skip to content

Uploading pictures with "Google Photos" via share doesn't work. #1066

Closed

Description

@OlivierS1

Actual behaviour

-Tell us what happens
I just installed "Google Photos" app on my cellphone to debug issues my friend is having.
This new issue targets both Nextcloud 1.4.3 and Nextcloud Dev 20170602, but the Dev version doesn't work at all.

Issue with Nextcloud 1.4.3:

With a few pictures available in "Google Photos", I select a few of them, then click the "Share" logo.
I am given a choice of application. I choose "Nexctloud".
I select the format to be either "LArge size" or "Actual size".
A progress bar will appear indicating how many files are being downloaded.
If the files are not on the device, they will be downloaded (I believe the folder they are going to be stored at is the "Download" folder). When all the files have been downloaded, Nextloud app will appear asking for the folder to upload to. I use the pin to access Nextcloud.
I select my folder then press Upload. Upon pressing the button, "Google Photos" appears.
Background uploading of the pictures by Nextcloud starts.
The problem is that not all pictures are being uploaded.
At a minimum, it seems consitstent at uploading one pictures per share request.
However, when selecting more than one pictures, I could only get at most 3 pictures uploaded by Nextcloud.
My friend was able to upload a larger number of files, but was always missing a few.

Expected behaviour

-Tell us what should happen
Nextcloud should be able to upload the entire selection provided by "Google Photos" and not skip a few files.

Steps to reproduce

  1. Have "Google Photos" app installed.
  2. Have a few pictures available in "Google Photos"
  3. Select a few pictures (max of 200)
  4. Click the "Share" icon
  5. Select "Nextcloud" within the list of apps.
  6. Enter PIN number, select relevant Nextcloud account if more than one installed within app.
  7. Select where to upload the files.
  8. Press "Upload" and wait for transfer to complete.
  9. Check files are properly uploaded on Nextcloud server. They will not.

Environment data

Android version:
6.0

Device model:
LG 3 D852
Samsung Note 5

Stock or customized system:
Stock on both phones

Nextcloud app version:
1.4.3

Nextcloud server version:
NC 12. (Just upgraded to NC12 a few days ago. Issue was first observed under NC 10 and NC 11)

Logs

Web server error log

Insert your webserver log here

Nextcloud log (data/nextcloud.log)

Insert your Nextcloud log here

NOTE: Be super sure to remove sensitive data like passwords, note that everybody can look here! You can use the Issue Template application to prefill some of the required information: https://apps.nextcloud.com/apps/issuetemplate

Activity

  1. OlivierS1 commented on Jun 5, 2017

    @OlivierS1
    Author

    With Nextcloud Dev, I was able to upload about 2 or 3 pictures after uninstalling my other accounts on the app.
    Doing more testing on Samsung Note 5, I was able to uploads about 5 files.

  2. AndyScherzinger commented on Jun 5, 2017

    @AndyScherzinger
    Member

    We need to investigate this one @mario @tobiasKaminsky. I don't know if there is a OS based limit on the amount of files (which would then be strange if Google let's you select 200 files to share though)

  3. OlivierS1 commented on Jun 5, 2017

    @OlivierS1
    Author

    @AndyScherzinger The limit is imposed on "Google Photos" side. Files over 200 need to use the link, but then it is limited to 2000.
    The reason I selected the maximum available number of pictures to upload is to investigate the behavior over a certain amount of files and over time in order to search for a pattern.
    What I found, is that I was having the same problem if instead of sharing via Nextcloud I would be sharing via "Total Commander" which I have installed on my phone. This is a file browser.
    What I got is a series of error messages related to file reading errors. As far as I was able to deduct, only files that are local to my phone and shared with "Google Photos" seem to upload with "Total Commander". The files are properly stored within the folder of choice on the phone.
    The ones that are not local to the phone seem to exhibit the issue and cause the error.
    I recorded a video to be able to read what the messages were about and here is what I gathered during transfer:

    Sending file From: content:// com.google.android.apps.photos.contentprovider/0/1/shared:/local%............................................................ To: /storage/emulated/0/download/test/2/NNNNNNN.jpg

    'Error reading file!
    content://com.google.android.apps.photos.contentprovider/0/1/shared:/local%............................................................-/REQUIRE_ORIGINAL/NONE/NNNNNN
    '
    I edited the names above and replaced with "..................................." and "NNNNNNNNNNNNNN" file names and file share name.

    Trying with 6 pictures that proved successful with "Total Commander", only one is actually being uploaded to Nextcloud.
    I think some handshaking is not being conducted properly between "Google Photos" and Nextcloud.

  4. tobiasKaminsky commented on Jun 28, 2017

    @tobiasKaminsky
    Member

    So as far as I understand is that it is not working if the images that you share from photos -> nextcloud are not downloaded/stored on device?
    I would have expect that google photo is first downloading them and then shares them to another app. At least this is what we do...
    I am unsure how we can improve this?

  5. added
    needs infoWaiting for info from user(s). Issues with this label will auto-stale.
    on Jun 28, 2017
  6. OlivierS1 commented on Jun 28, 2017

    @OlivierS1
    Author

    @tobiasKaminsky When I share the files from Photos, if the pictures are not on the device, Photos will download them. If I want to share 50 pictures I will see a progress bar showing the download in progress counting down from 50 down to 1. The pictures that are already on the device will see a fast forward drop in remaining pictures to process. Only after the files seems to have been downloaded that Photos will provide the share menu with the list of the various apps. Even with a few pictures already present on the device, only 1 pictures will be uploaded on my device.

  7. tobiasKaminsky commented on Jun 30, 2017

    @tobiasKaminsky
    Member

    I tried it with 2 non-downloaded pictures.
    First they were downloaded and then successfully uploaded to nextcloud.
    I think that we need a logcat (https://wiki.lineageos.org/logcat.html) in order to get the cause of the problem you have.

  8. OlivierS1 commented on Jun 30, 2017

    @OlivierS1
    Author

    Where should I send the logcat file?

  9. tobiasKaminsky commented on Jul 1, 2017

    @tobiasKaminsky
    Member

    Please send it to android at nextcloud dot com with a reference to this issue.

  10. OlivierS1 commented on Jul 1, 2017

    @OlivierS1
    Author

    Logcat sent.

  11. removed
    needs infoWaiting for info from user(s). Issues with this label will auto-stale.
    on Jul 4, 2017
  12. tobiasKaminsky commented on Jul 4, 2017

    @tobiasKaminsky
    Member

    @OlivierS1 thanks for the logcat.
    We will have look into it.

    06-18 23:34:09.417 30289 30289 E AndroidRuntime: Process: com.nextcloud.android.beta, PID: 30289
    
    06-18 23:34:09.417 30289 30289 E AndroidRuntime: java.lang.IllegalArgumentException: columnCount must be greater than or equal to the maximum of all grid indices (and spans) defined in the LayoutParams of each child. 
    
    06-18 23:34:09.417 30289 30289 E AndroidRuntime: 	at android.widget.GridLayout.handleInvalidParams(GridLayout.java:823)
    
    06-18 23:34:09.417 30289 30289 E AndroidRuntime: 	at android.widget.GridLayout.access$200(GridLayout.java:161)
    
    06-18 23:34:09.417 30289 30289 E AndroidRuntime: 	at android.widget.GridLayout$Axis.setCount(GridLayout.java:1263)
    
    06-18 23:34:09.417 30289 30289 E AndroidRuntime: 	at android.widget.GridLayout.setColumnCount(GridLayout.java:423)
    
    06-18 23:34:09.417 30289 30289 E AndroidRuntime: 	at com.owncloud.android.ui.adapter.ActivityListAdapter$1.run(ActivityListAdapter.java:182)
    
    06-18 23:34:09.417 30289 30289 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:739)
    
    06-18 23:34:09.417 30289 30289 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
    
    06-18 23:34:09.417 30289 30289 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:148)
    
    06-18 23:34:09.417 30289 30289 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:5551)
    
    06-18 23:34:09.417 30289 30289 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
    
    06-18 23:34:09.417 30289 30289 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
    
    06-18 23:34:09.417 30289 30289 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
    
  13. tobiasKaminsky commented on Jul 11, 2017

    @tobiasKaminsky
    Member

    Unfortunately the logcat does not have a relation to sharing from google photos.
    It is an error about the activity view, which I circumvented in #1173.

  14. OlivierS1 commented on Jul 11, 2017

    @OlivierS1
    Author

    @tobiasKaminsky What are you trying to say?

  15. tobiasKaminsky commented on Jul 12, 2017

    @tobiasKaminsky
    Member

    This means that the error (#1066 (comment)) I extracted from your logcat was not related to google photo.

    After digging again in it I found an error related to google photo:

    06-30 14:26:04.700 29672 29684 E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading com.google.android.apps.photos.contentprovider.impl.MediaContentProvider uri content://com.google.android.apps.photos.contentprovider/0/1/mediakey%3A%2Flocal%253Aed6e226a-cf09-4331-a5c1-a6a4b63a4382/REQUIRE_ORIGINAL/NONE/14907489 from pid=22172, uid=10242 requires the provider be exported, or grantUriPermission()
    06-30 14:26:04.700 29672 29684 E DatabaseUtils: 	at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:605)
    
    06-30 14:26:04.700 29672 29684 E DatabaseUtils: 	at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:480)
    
    06-30 14:26:04.700 29672 29684 E DatabaseUtils: 	at android.content.ContentProvider$Transport.enforceFilePermission(ContentProvider.java:471)
    
    06-30 14:26:04.700 29672 29684 E DatabaseUtils: 	at android.content.ContentProvider$Transport.openTypedAssetFile(ContentProvider.java:416)
    
    06-30 14:26:04.700 29672 29684 E DatabaseUtils: 	at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:313)
    
    06-30 14:26:04.700 29672 29684 E DatabaseUtils: 	at android.os.Binder.execTransact(Binder.java:453)
    
    06-30 14:26:04.703 22172 22172 V UploadsStorageManager: No upload was killed
    
    06-30 14:26:04.705 22172 22172 D FileUploader: Starting command with id 1
    
    
    line: 14321
    

    Strange is that one picture is uploaded successfully...

    Can you try it again with:

    • share 1 downloaded image
    • share 5 downloaded images
    • share 50 downloaded images
    • share 1 non-downloaded image
    • share 5 non-downloaded images
    • share 50 non-downloaded images
  16. OlivierS1 commented on Jul 17, 2017

    @OlivierS1
    Author

    No success with Google Photos share.
    With pictures on device, I was able to send at most 6 photos.
    With pictures not on device, I cna't get more than 2 maybe 3.
    I have tried sending the same pictures, more or less via Whatsapp and it seems I was able to send 25, all successful.
    However, trying like 50 or 60 would fail with whatsapp.
    So, this clearly shows an issue with Netcloud app.
    I have noticed, that when sending to Whatsapp, Google Photos takes a bit more time after it has downloaded the files before actually sending them to the app.
    I believe the issue is within Google Photos and Nextcloud protocol communication.

  17. OlivierS1 commented on Aug 11, 2017

    @OlivierS1
    Author

    @tobiasKaminsky Any type of resolution on this issue?

  18. pbloigu commented on Sep 22, 2017

    @pbloigu

    I think I have this exact same problem on my Nexus 6P with Android 8.0.0. Sharing a few (5-6) images from Photos works, but if I select more and then share to Nextcloud, it uploads only like 5-6 of them.

    Is there anything I can do to help investigate this? Any logs I could provide? The NC server in question is my own so I could dig into this also at the server side, if needed.

  19. maybeec commented on Dec 27, 2018

    @maybeec

    Hi,

    I experience the same issue for quite a while now.

    Nokia 7 plus with Android 8/9
    Different NC LTS Releases throughout this year.

    I have not been in android development for some years now, but just from what I read here. Couldn't it be that the URIs come with a time of validity, especially a time of validity of granting access to the resources?
    If so, this issue might be resolved by opening all files for reading directly after getting the URIs.

    Just a best guess :)

  20. stale commented on May 9, 2019

    @stale

    This request did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

  21. MatthiasLohr commented on Sep 27, 2019

    @MatthiasLohr

    Is there any known solution for this problem? Just started to use Nextcloud and found this problem...

  22. BrettRD commented on May 25, 2020

    @BrettRD

    duplicate of #369?

    I ran into this bug last week trying to organize my collection.
    I think the problem is that the files selected for upload are not on the device until Google Photos downloads them into a temporary cache.
    It started off fine, but as my device filled up, google photos was removing the files from disk faster than the nextcloud upload queue could get to them, leaving me with just a few 'file not on device' errors in the upload queue.

    I gave up when I couldn't upload a large video at all. Photos would download a fresh copy every time I asked for it, and delete it from cache before the upload got going.

    A fix would be to perform a copy into nextcloud controlled local disk space before telling Photos you were done with the file URI, and then stage the upload from there.
    The bugs would then at least be intelligible because the device would simply run out of memory and tell the user the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions