nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.15k stars 1.75k forks source link

Can't open MS Office files with external apps #11216

Open teclab-at opened 1 year ago

teclab-at commented 1 year ago

⚠️ Before posting ⚠️

Steps to reproduce

  1. Make a file available offline without having the dedicated App on your phone installed - e.g. Excel document without having Office installed on the phone.
  2. Click the file - an error Dialog appears.

Expected behaviour

The error message should read something like "No App found for this type of document"

Actual behaviour

The error message is "This file isn't available offline. Make file "Available offline" in the file's Options menu.

First the message directs the user to a wrong cause, and second the "Available offline" menu does not exist any more.

Android version

12

Device brand and model

Motorola

Stock or custom OS?

Stock

Nextcloud android app version

3.23.1

Nextcloud server version

25.0.2

Using a reverse proxy?

No

Android logs

No response

Server error logs

No response

Additional information

No response

AlvaroBrey commented 1 year ago

The error message is "This file isn't available offline. Make file "Available offline" in the file's Options menu.

This message isn't coming from the Nextcloud app; that string is nowhere in our code (and I also failed to reproduce this). You probably have an app installed that is trying to open the file, but failing.

teclab-at commented 1 year ago

There is a reference from 2019 but I do not understand the fix for it: https://github.com/vinzscam/react-native-file-viewer/issues/40 Also attaching a screenshot for verification. Screenshot_20230109-185315

teclab-at commented 1 year ago

Another ref here: https://help.nextcloud.com/t/nextcloud-app-doesnt-open-documents-cant-open-this-document/151366

And this ref https://help.nextcloud.com/t/how-to-open-view-and-edit-spreadsheets-and-docx-files-on-android/75540/6 suggests that NextCloud is handling the online link to the App instead of pointing to the downloaded file. Could this be the case?

AlvaroBrey commented 1 year ago

NextCloud is handling the online link to the App instead of pointing to the downloaded file

Not sure if this is the exact cause, but let me try to reproduce this with Google Docs installed

AlvaroBrey commented 1 year ago

I can reproduce this with Google Docs, but it looks like it might be a problem with Google Docs. The same file opens correctly through Nextcloud if I choose to open with OnlyOffice, for example.

AlvaroBrey commented 1 year ago

From logcat:

023-01-10 10:16:08.070  4029-19008 MediaProvider           pid-4029                             E  Permission to access file: /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/test@192.168.1.xx/sample4.docx is denied
2023-01-10 10:16:08.070  3472-3472  OcmManagerImpl          pid-3472                             W  officeFileUri set to: file:///storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/test%40192.168.1.xx/sample4.docx
2023-01-10 10:16:08.076  1563-13925 CoreBackPreview         pid-1563                             D  Window{6865a62 u0 com.google.android.apps.docs.editors.docs/com.google.android.apps.docs.editors.kix.quickword.QuickWordDocumentOpenerActivityAlias}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@95a1cb0, mPriority=0}
2023-01-10 10:16:08.079  3472-3472  ChangelingKixImportTask pid-3472                             E  onUncaughtException
                                                                                                    java.io.FileNotFoundException: /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/test@192.168.1.71/sample4.docx: open failed: EACCES (Permission denied)
                                                                                                        at libcore.io.IoBridge.open(IoBridge.java:574)
                                                                                                        at java.io.FileInputStream.<init>(FileInputStream.java:160)
                                                                                                        at java.io.FileInputStream.<init>(FileInputStream.java:115)
                                                                                                        at android.content.ContentResolver.openInputStream(ContentResolver.java:1516)
                                                                                                        at exh.b(PG:2)
                                                                                                        at evn.doInBackground(PG:14)
                                                                                                        at android.os.AsyncTask$3.call(AsyncTask.java:394)
                                                                                                        at java.util.concurrent.FutureTask.run(FutureTask.java:264)
                                                                                                        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
                                                                                                        at java.util.concurrent.FutureTask.run(FutureTask.java:264)
                                                                                                        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
                                                                                                        at java.lang.Thread.run(Thread.java:1012)
                                                                                                    Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
                                                                                                        at libcore.io.Linux.open(Native Method)
                                                                                                        at libcore.io.ForwardingOs.open(ForwardingOs.java:563)
                                                                                                        at libcore.io.BlockGuardOs.open(BlockGuardOs.java:274)
                                                                                                        at libcore.io.ForwardingOs.open(ForwardingOs.java:563)
                                                                                                        at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7754)
                                                                                                        at libcore.io.IoBridge.open(IoBridge.java:560)
                                                                                                        at java.io.FileInputStream.<init>(FileInputStream.java:160) 
                                                                                                        at java.io.FileInputStream.<init>(FileInputStream.java:115) 
                                                                                                        at android.content.ContentResolver.openInputStream(ContentResolver.java:1516) 
                                                                                                        at exh.b(PG:2) 
                                                                                                        at evn.doInBackground(PG:14) 
                                                                                                        at android.os.AsyncTask$3.call(AsyncTask.java:394) 
                                                                                                        at java.util.concurrent.FutureTask.run(FutureTask.java:264) 
                                                                                                        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463) 
                                                                                                        at java.util.concurrent.FutureTask.run(FutureTask.java:264) 
                                                                                                        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307) 
                                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) 
                                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) 
                                                                                                        at java.lang.Thread.run(Thread.java:1012) 

Maybe something's wrong with our contentprovider, but I find it weird that it would work with OnlyOffice but not Docs.

AlvaroBrey commented 1 year ago

Collabora also fails to load the file when opened this way (at least in my device). OnlyOffice and MS Word request All Files permission and they work.

This seems to be a permission issue with our provider.

joshtrichards commented 10 months ago

Does the workaround in #6377 work? Looks similar to both #10893 and #6377

jrhellriegeljr commented 10 months ago

I tested it first by upgrading from 3.21.2 (the last version that worked) and it was broken and not fixed by changing the folder. I then wiped storage, uninstalled it and reinstalled it then selected the folder again and it still didn't solve the problem, so this confirms that it is still happening in 3.26.0 and the workaround doesn't work to resolve the issue - at least not for me.

One other note - that issues most recent update predates this issue even existing.

I do however appreciate the thought. I'd really love for this to work again - in the meantime I've downgraded back to 3.21.2. :(

Jim

krowvin commented 8 months ago

I got around this by uninstalling Google sheets and using Microsoft Excel: Spreadsheets for the document I was trying to open.

Agreed it is on the third party app struggling to open the file.

At first I thought it was my Google drive syncing my nextcloud directory on my desktop. (I.e. maybe drive tried to delete local files and make them stream)

Android Pixel 8 NC Mobile app version 3.26.0 NC server : 25.0.13

jrhellriegeljr commented 8 months ago

I don't even have Google Sheets installed on my phone to try this. I don't use it for all the reasons I do use Nextcloud. ☺ I still wish this was fixed though, it's been over a year at this point.

mxsrm commented 2 months ago

How is this bug still not fixed? Is not only affecting Sheets but also alternatives like OnlyOffice. Only thing working right now is MS Office and that is almost as bad as using Google Sheets.