android icon indicating copy to clipboard operation
android copied to clipboard

Can't open MS Office files with external apps

Open teclabat opened this issue 2 years ago • 12 comments

⚠️ Before posting ⚠️

  • [X] This is a bug, not a question or an enhancement.
  • [X] I've searched for similar issues and didn't find a duplicate.
  • [X] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
  • [X] I agree to follow Nextcloud's Code of Conduct.

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

teclabat avatar Jan 02 '23 20:01 teclabat

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.

AlvaroBrey avatar Jan 09 '23 16:01 AlvaroBrey

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

teclabat avatar Jan 09 '23 17:01 teclabat

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?

teclabat avatar Jan 09 '23 18:01 teclabat

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 avatar Jan 10 '23 08:01 AlvaroBrey

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 avatar Jan 10 '23 09:01 AlvaroBrey

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/[email protected]/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/[email protected]/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 avatar Jan 10 '23 09:01 AlvaroBrey

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.

AlvaroBrey avatar Jan 10 '23 09:01 AlvaroBrey

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

joshtrichards avatar Oct 15 '23 15:10 joshtrichards

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

jrhellriegeljr avatar Oct 16 '23 02:10 jrhellriegeljr

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

krowvin avatar Dec 08 '23 15:12 krowvin

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.

jrhellriegeljr avatar Dec 08 '23 18:12 jrhellriegeljr

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.

mxsrm avatar Jun 16 '24 18:06 mxsrm