Android: sync crashes if file is added to media dir by other app

Created on 13 Jul 2019  Â·  13Comments  Â·  Source: nextcloud/android

Actual behaviour

  • use another app to create a new file in a sync-ed dir.
  • tell nextcloud to sync
  • sync crashes, "nextcloud had stopped"

Expected behaviour

  • nextcloud should find the new file and sync it (upload it), this is how the other sync clients work on desktop

Steps to reproduce

  1. Sync a dir
  2. Use other app to create file in the directory that NC has created and put these sync-ed files in
  3. In NC tap menu by the dir and choose sync
  4. Wait
  5. Crashes

Environment data

Android version:8.1

Device model: Moto g5+

Stock or customized system:

Nextcloud app version: 3.7

Nextcloud server version:15.0.8

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

bug stale

Most helpful comment

Well, storage is accessible from anywhere while an app's storage is still considered private.
What I meant with file picker is the Android mechanism where you can also see any cloud provider and your accounts on the device. So this question is more about does Markor support the document provider interface? And if not, could Markor just implement support for it (which would help them a lot to support many clouds)

All 13 comments

Hmmm. Not sure if this is quite right.

I think actually it's that the sync takes so long that Android thinks it's crashed. If I clicked 'wait' to the several notifications about Nextcloud not responding it did actually seem to sync the new file.

The directory in question has 200 small files in, if that matters.

Have you already tried with one single file or folder? For me, adding stuff outside the app, i.e. on the local filesystem, is not working at all.

  1. Sync a folder inside the NC app
  2. Open an editor and create a text file (just an example) in this folder
  3. Sync again and check if the file has been uploaded to NC

In my case, the file is not being synced/uploaded. (On my computer it is working as expected.)

But I cannot confirm it crashes. Syncing takes a while and the app freezes, but I tell it to wait and after a moment the app is reacting again. Can you confirm this? (I have just tried this on a Mi MIX 2.)

  1. Using the web UI, I created a folder. I added a test1.md file inside it.
  2. On the android app I clicked Sync on the folder. A Green tick appeared, test1.md was downloaded.
  3. I added test2.md in the /android/media/org.nextcloud.com/.../test folder using a different phone app (Marktor)
  4. I clicked sync on the Nextcloud app.

This time nothing happens; no crash, no whirring circle or pixels scrolling; no notifications; but NC does not see the new file, nor does it upload it.

Just can't figure out what 'sync' is supposed to do on the NC app beyond downloading the latest version.

So the issue could be reproduced. I did also create my file with markor btw. (but this is just a coincedence and not related to the bug, I guess).

Cc @tobiasKaminsky

Sync does work with known files which either come from the server or are created or added within the app. Other apps should write stuff to the app's very own, private space.
So the app shouldn't crash (that should be covered) but other apps should not be used in this way (not how Android works, while it doesn't prohibit it...)

Does Markor support a proper use of Android's file picker? If so then you should rather interact with you Nextcloud/Client through that interface which will then take care of handling the server communications through the Nextcloud app in the background.

Does this mean we should try with a different editor? I do not know much about the internals of markor, but it uses a proper file browser to open and create files. So it depends on the app I use if files are being synced or not? Thanks for clarifying! Is this maybe somewhere documented? It would be good to inform the users about this (not so small) limitation, I guess… 😃

@AndyScherzinger Thanks for some clarifications, although they open up new questions.

I confirm that:

  1. NC App
  2. three dots next to a file → Edit With → select app (e.g.Marktor)
  3. in other app press Save.
  4. in NC App select Sync

Does sync the changes to the existing file.

However with what you suggest there's no way to create a new file on the phone.

NC App has a + button but only offers to "upload files" or "upload content from other apps" (who knows what the difference is there), "upload from camera" or "create folder".

So I can't create a file in NC app; then edit it with another app.

The only way seems to be

  1. create a new file with another app
  2. use NC app to try to find the file (wherever that may have ended up!) to take a copy of the file into NC
  3. then use a file browser or other app to remove the original one
  4. finally to edit it start NC → Edit With → other app → Save → press Sync (I think it might auto sync periodically, but that period seems far too long to be useful so you can easily end up with conflicts)

It's a bit of a long way around.

I was also wondering how to create a new file within the NC app. I can create a new folder, but it seems that empty folders are not being synced, so I cannot even copy files into it from outside the app, correct?

Actually, on my step 3, when you do "Upload files" you get three options.

  1. Move file to Nexcloud folder: this does as it says. The other app thinks the file is gone now. At least donig this removes my step 3 above.

  2. Keep file in source folder: This copies the file.

  3. Delete file from source folder: this also seems to copy the file; the source file is not deleted.

I'm surprised this is to do with Android's data storage. I know Apple (eeuw!) have a ridiculous policy of apps own data - so you can't have 2 text editors that access the same files; or two music apps that play the same files; but I did not know Android did that; the storage thing seems very open. is it just that NC chooses to keep its data in a private file storage area?

Well, storage is accessible from anywhere while an app's storage is still considered private.
What I meant with file picker is the Android mechanism where you can also see any cloud provider and your accounts on the device. So this question is more about does Markor support the document provider interface? And if not, could Markor just implement support for it (which would help them a lot to support many clouds)

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!

I'm closing this because it feels like this is not the way it's designed to work. (I mean it's a shame it's not designed to work that way, but that's another matter!)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ezaquarii picture ezaquarii  Â·  3Comments

tobiasKaminsky picture tobiasKaminsky  Â·  3Comments

eppfel picture eppfel  Â·  3Comments

ikke-t picture ikke-t  Â·  3Comments

rainer042 picture rainer042  Â·  3Comments