owncloud / android

:phone: The ownCloud Android App
GNU General Public License v2.0
3.82k stars 3.05k forks source link

[BUG] - Owncloud is unable to load directory content #4375

Closed Lord-Y closed 5 months ago

Lord-Y commented 6 months ago

Actual behaviour

-Tell us what happens

Hello guys, it's been a while (like almost a year) since owncloud is not uploading any photos or videos after using the camera. When I checked the permission of the application, I cannot find any in android permission. I'm using androind 14. When trying to authorize accessed, it just fail by saying 'impossible to load content for the moment". I enabled audit log in the app but there is nothing in there. Reinstall the application doesn't change anything. When manually choosing a photo or a video and share it to owncloud, the app successfully upload the file to my server. My owncloud server as nothing special, it's a docker image deployed with the required setting to upload files.

I personally don't think that's a server problem but more an app problem as it is unable to load directory content. For your information, I have 10420 medias (9312 photos and 1108 videos) . Most of them have been uploaded but I guess like the app is unable to list all those files.

Expected behaviour

-Tell us what should happen

Well it should work.

Steps to reproduce

See screenshot/videos below

Can this problem be reproduced with the official owncloud server? yes (url: https://demo.owncloud.org, user: test, password: test)

Environment data

Android version: 14

Device model: Samsung Galaxy S22+

ownCloud app version: 4.2.1

ownCloud server version: 10.14.0

Logs

Web server error log

N/A

ownCloud log (data/owncloud.log)

D: 2024-04-06 22:05:25:755(LogsProvider.kt:49)release start logging 4.2.1 a41d1f917
D: 2024-04-06 22:05:25:771(ThumbnailsCacheManager.java:103)create dir: /storage/emulated/0/Android/data/com.owncloud.android/cache/thumbnailCache
D: 2024-04-06 22:05:25:775(MainApp.kt:115)SettingsActivity onCreate(Bundle) starting
V: 2024-04-06 22:05:25:803(MainApp.kt:193)SettingsActivity onStart() starting
V: 2024-04-06 22:05:25:809(MainApp.kt:200)SettingsActivity onResume() starting
D: 2024-04-06 22:05:25:809(SettingsPictureUploadsViewModel.kt:215)Picture uploads configuration updated. New configuration: FolderBackUpConfiguration(accountName=REDACTED_USER_SERVER, behavior=COPY, sourcePath=content://com.android.externalstorage.documents/tree/primary%3ADCIM%2FCamera, uploadPath=/PhotosPhone/, wifiOnly=true, chargingOnly=false, lastSyncTimestamp=1712433925809, name=Picture uploads, spaceId=null)
I: 2024-04-06 22:05:25:901(CameraUploadsWorker.kt:78)Starting CameraUploadsWorker with UUID 74d0b218-e0c1-49b4-807d-b66af5fc5523
V: 2024-04-06 22:06:07:348(MainApp.kt:204)SettingsActivity onPause() ending
V: 2024-04-06 22:06:07:468(MainApp.kt:208)SettingsActivity onStop() ending
V: 2024-04-06 22:06:07:473(MainApp.kt:215)SettingsActivity onSaveInstanceState(Bundle) starting
V: 2024-04-06 22:06:17:748(MainApp.kt:193)SettingsActivity onStart() starting
V: 2024-04-06 22:06:17:756(MainApp.kt:200)SettingsActivity onResume() starting
V: 2024-04-06 22:06:43:177(MainApp.kt:204)SettingsActivity onPause() ending
D: 2024-04-06 22:06:43:188(MainApp.kt:115)LogsListActivity onCreate(Bundle) starting
V: 2024-04-06 22:06:43:203(MainApp.kt:193)LogsListActivity onStart() starting
V: 2024-04-06 22:06:43:204(MainApp.kt:200)LogsListActivity onResume() starting
V: 2024-04-06 22:06:43:757(MainApp.kt:208)SettingsActivity onStop() ending
V: 2024-04-06 22:06:43:761(MainApp.kt:215)SettingsActivity onSaveInstanceState(Bundle) starting
V: 2024-04-06 22:06:46:444(MainApp.kt:204)LogsListActivity onPause() ending
D: 2024-04-06 22:06:48:722(MainApp.kt:115)ReceiveExternalFilesActivity onCreate(Bundle) starting
V: 2024-04-06 22:06:48:745(MainApp.kt:193)ReceiveExternalFilesActivity onStart() starting
D: 2024-04-06 22:06:48:745(BaseActivity.java:177)Account set: REDACTED_USER_SERVER
D: 2024-04-06 22:06:48:753(DrawerActivity.kt:446)Update Quota
D: 2024-04-06 22:06:48:756(ViewModelExt.kt:68)Use case executed: GetStoredQuotaUseCase with result: Success(data=UserQuota(accountName=REDACTED_USER_SERVER, available=-3, used=416225251041))
V: 2024-04-06 22:06:48:757(MainApp.kt:200)ReceiveExternalFilesActivity onResume() starting
W: 2024-04-06 22:06:48:757(DrawerActivity.kt:558)setDrawerMenuItemChecked has been called with invalid menu-item-ID
D: 2024-04-06 22:06:48:766(OperationsService.java:92)Creating service
D: 2024-04-06 22:06:48:772(ReceiveExternalFilesActivity.java:535)Populating view with content of : /
D: 2024-04-06 22:06:48:826(FileActivity.java:386)Operations service connected
V: 2024-04-06 22:06:49:198(MainApp.kt:208)LogsListActivity onStop() ending
V: 2024-04-06 22:06:49:200(MainApp.kt:215)LogsListActivity onSaveInstanceState(Bundle) starting
D: 2024-04-06 22:06:51:644(ReceiveExternalFilesActivity.java:497)Uploading file to dir /
D: 2024-04-06 22:06:51:645(BaseActivity.java:292)show loading dialog

Screenshot from 2024-04-06 22-18-51

https://github.com/owncloud/android/assets/8832734/35c891ce-9732-49a5-a692-32926ae69bf4

Screenshot_20240406_223814_Settings

JuancaG05 commented 5 months ago

Hi @Lord-Y! Thanks for opening a new issue! 🍻

I see, strange behaviour! Just some things to make clear:

  1. Auto-uploads only work with newly-created files in the folder you chose, so doesn't mind how many files there are in the folder (or at least shouldn't). I think you already know this but just to make it totally clear πŸ‘
  2. I don't see any abnormal line in the logs. Just one thing that caught my attention: are you using an oC10 or an oCIS server? spaceId was set to null in the FolderBackupConfiguration, and that should happen just when you are using oC10 servers
  3. Have you tried selecting any other source folder? For example, select any other folder and just copy manually there a new picture or video to "simulate" that there is a new photo or video taken and trigger the auto-uploads

You tell us, and we'll try to help you out πŸ‘

Lord-Y commented 5 months ago

Hi @JuancaG05 thanks for reaching out, my comments below:

Hi @Lord-Y! Thanks for opening a new issue! 🍻

I see, strange behaviour! Just some things to make clear:

  1. Auto-uploads only work with newly-created files in the folder you chose, so doesn't mind how many files there are in the folder (or at least shouldn't). I think you already know this but just to make it totally clear πŸ‘

Alright. It's more clear

  1. I don't see any abnormal line in the logs. Just one thing that caught my attention: are you using an oC10 or an oCIS server? spaceId was set to null in the FolderBackupConfiguration, and that should happen just when you are using oC10 servers

I'm using oC10 servers. But I tried oCIS once last year with an another server url and another data folder on server side.

  1. Have you tried selecting any other source folder? For example, select any other folder and just copy manually there a new picture or video to "simulate" that there is a new photo or video taken and trigger the auto-uploads

You tell us, and we'll try to help you out πŸ‘

So I tried and yes it works perfectly and here are some relevant logs:

I: 2024-04-08 09:58:40:856(CameraUploadsWorker.kt:256)25 files found in folder: /tree/primary:Pictures/Twitter
I: 2024-04-08 09:58:40:857(CameraUploadsWorker.kt:257)1 files are PICTURE_UPLOADS and were taken after last sync
I: 2024-04-08 09:58:40:899(UploadFileFromContentUriUseCase.kt:62)Plain upload of /tree/primary:Pictures/Twitter/document/primary:Pictures/Twitter/20240408_095452.jpg has been enqueued.

D: 2024-04-08 10:00:45:375(SingleSessionManager.java:180)getClientFor finishing 
D: 2024-04-08 10:00:45:377(GetRemoteUserAvatarOperation.kt:53)avatar URI: https://owncloud.lord-y.com/index.php/avatar/Lord-Y/360
D: 2024-04-08 10:00:45:594(UploadFileFromContentUriWorker.kt:154)Upload with id (5356) has been found in database.
D: 2024-04-08 10:00:45:594(UploadFileFromContentUriWorker.kt:155)Upload info: OCTransfer(id=5356, localPath=content://com.android.externalstorage.documents/tree/primary%3APictures%2FTwitter/document/primary%3APictures%2FTwitter%2F20240408_095452.jpg, remotePath=/Twitter//20240408_095452.jpg, accountName=REDACTED, fileSize=230168, status=TRANSFER_QUEUED, localBehaviour=COPY, forceOverwrite=false, transferEndTimestamp=null, lastResult=null, createdBy=ENQUEUED_AS_CAMERA_UPLOAD_PICTURE, transferId=null, spaceId=null)
W: 2024-04-08 10:00:45:623(GetRemoteUserAvatarOperation.kt:67)Not an image, failing with no avatar
D: 2024-04-08 10:00:45:623(OwnCloudClient.java:129)Executing in request with id c54e4311-7514-431d-b386-bb5dcf661d98
D: 2024-04-08 10:00:45:624(AvatarManager.kt:114)Fetch avatar use case is success: false
I: 2024-04-08 10:00:45:624(AvatarManager.kt:140)No avatar available, removing cached copy
D: 2024-04-08 10:00:45:624(DiskLruImageCache.java:142)removeKey from cache: 713852434
I: 2024-04-08 10:00:45:626(AvatarManager.kt:87)Avatar with imageKey a_REDACTED is not available in cache. Generating one...

I: 2024-04-08 10:00:46:989(UploadFileFromFileSystemOperation.kt:89)Upload of /data/user/0/com.owncloud.android/files/owncloud/tmp/REDACTED/Twitter//20240408_095452.jpg to /Twitter//20240408_095452.jpg - HTTP status code: 207
V: 2024-04-08 10:00:48:230(FileDisplayActivity.kt:780)onPause() start
V: 2024-04-08 10:00:48:231(MainApp.kt:204)FileDisplayActivity onPause() ending
V: 2024-04-08 10:00:48:232(FileDisplayActivity.kt:788)onPause() end

image

But when I switched back to the camera folder I got the loading issue said previously. I then took a picture and waited but nothing has been uploaded.

The spaceId is still null after changing to Twitter folder.

D: 2024-04-08 09:51:24:458(SettingsPictureUploadsViewModel.kt:215)Picture uploads configuration updated. New configuration: FolderBackUpConfiguration(accountName=REDACTED, behavior=COPY, sourcePath=content://com.android.externalstorage.documents/tree/primary%3ADCIM%2FCamera, uploadPath=/Twitter/, wifiOnly=true, chargingOnly=false, lastSyncTimestamp=1712434416382, name=Picture uploads, spaceId=null)
JuancaG05 commented 5 months ago

Hi @Lord-Y! Thanks for the tests on your side!

So, firstly I would say it's a problem of the folder, since as you saw, trying with another folder it works correctly, the app is able to open it and show its content. Your default Camera folder may be corrupted or damaged in some way, and that's why ownCloud (actually, Android, since the documents provider -the folder picker- is provided by the Operating System) cannot open it and thus take new content from it. If you are using a oC10 server, spaceId will be always null, so don't worry about that.

Secondly, I would highly recommend to upgrade to an oCIS server, it has the same features you are enjoying right now with your oC10 server but improved, and many new ones! I don't think it's related but it may help you to solve your problem somehow since you'll have to configure everything again on your app.

So, in conclusion, since we can see nothing suspicious in the logs that can lead to an existing bug in the app, I encourage you to upgrade to an oCIS server if you feel like, and try to somehow recreate your default Camera folder (for example, move all its content to an auxiliar folder, remove the Camera folder, and take a new picture with your camera so that the folder is automatically recreated). I would try the recreation of the folder at least, for you to be able to use the auto-uploads feature normally πŸ˜ƒ.

Lord-Y commented 5 months ago

Hi @JuancaG05 Thx for your feedback. I installed my oCIS server last week and planned to migrate soon. Is there anyway to debug why it cannot use the Camera folder? That log will then end up in the audit log so we care really understand why it's not working? When I'm getting in the camera folder I can see everything without any problem, thumbnails,size etc so I don't think it's a Camera folder issue.

JuancaG05 commented 5 months ago

Hi @Lord-Y!

Indeed, the file explorer is not part of the ownCloud Android app, so that's why we cannot see anything in the logs about it. The file explorer in this case is provided by the Android OS, therefore my opinion that it must be a problem either of the Android file explorer or of the folder you're trying to see, and testing that it works with another similar folders, it seems the real problem is the folder (damaged doesn't mean it cannot be browsed with other explorers , the Gallery app, etc).

BTW, cool that you're planning to migrate to oCIS! πŸ’―

JuancaG05 commented 5 months ago

Closing this one since it seems to not be related with the app itself. In any case, if you make any findings or discover new bugs in the app, don't hesitate to open a new issue! πŸ‘