Bug 129833 - Android Viewer: Cannot connect to ownCloud
Summary: Android Viewer: Cannot connect to ownCloud
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Android Viewer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: ARM Android
: medium enhancement
Assignee: Michael Weghorn
URL:
Whiteboard: target:7.2.0
Keywords:
: 96786 117666 (view as bug list)
Depends on:
Blocks: mabAndroid
  Show dependency treegraph
 
Reported: 2020-01-06 12:29 UTC by Thomas Börner
Modified: 2021-03-23 05:56 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Börner 2020-01-06 12:29:30 UTC
Description:
When tapping on "ownCloud" in the file open dialog (upper left corner), a message appears "Unspecified error connecting to ownCloud server".
It actually does connect to the server but then fails.
Connecting with the native ownCloud client for Android succeeds.
Perhaps this is because the ownCloud API has been changed (dav vs. webdav). The native client connects successfully to /remote.php/dav/... while LibreOffice Viewer tries to connect to /remote.php/webdav/. (The OC server version is 10.3.2)

Here are the server logs:
1. nginx/access.log:
xxx.xxx.213.153 - thomas [06/Jan/2020:09:45:50 +0100] "PROPFIND /remote.php/webdav/ HTTP/1.1" 207 23291 "-" "Android-ownCloud"

1a. successful connection with the native ownCloud client:
xxx.xxx.213.153 - thomas [06/Jan/2020:13:08:59 +0100] "PROPFIND /remote.php/dav/files/thomas/documents/example.odt HTTP/1.1" 207 892 "-" "Mozilla/5.0 (Android) ownCloud-android/2.14.1"



2. owncloud.log (loglevel=0 (debug)):
Exception: HTTP/1.1 401 No public access to this resource., No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured: {"Exception":"Sabre\\DAV\\Exception\\NotAuthenticated","Message":"No public access to this resource., No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured","Code":0,"Trace":"#0 \/var\/www\/owncloud\/lib\/composer\/sabre\/event\/lib\/WildcardEmitterTrait.php(96): Sabre\\DAV\\Auth\\Plugin->beforeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#1 \/var\/www\/owncloud\/lib\/composer\/sabre\/dav\/lib\/DAV\/Server.php(448): Sabre\\DAV\\Server->emit('beforeMethod:PR...', Array)\n#2 \/var\/www\/owncloud\/lib\/composer\/sabre\/dav\/lib\/DAV\/Server.php(241): Sabre\\DAV\\Server->invokeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#3 \/var\/www\/owncloud\/apps\/dav\/lib\/Server.php(326): Sabre\\DAV\\Server->start()\n#4 \/var\/www\/owncloud\/apps\/dav\/appinfo\/v2\/remote.php(31): OCA\\DAV\\Server->exec()\n#5 \/var\/www\/owncloud\/remote.php(165): require_once('\/var\/www\/ownclo...')\n#6 {main}","File":"\/var\/www\/owncloud\/lib\/composer\/sabre\/dav\/lib\/DAV\/Auth\/Plugin.php","Line":161}




Steps to Reproduce:
1.Open LibreOffice Viewer for Android
2.Tap on the menu icon in the upper left corner
3.chose ownCloud

Actual Results:
error message "Unspecified error connecting to ownCloud server"

Expected Results:
open remote folder list in ownCloud


Reproducible: Always


User Profile Reset: No



Additional Info:
App Version 5.2.3.1/01ec8f3
Comment 1 Michael Weghorn 2020-01-08 09:09:57 UTC
The version you're using is outdated. Can you please try with a daily build as available at [1] and report back whether it's working there?

[1] https://dev-builds.libreoffice.org/daily/master/Android-ARM@24-Bytemark-Hosting/
Comment 2 Thomas Börner 2020-01-08 10:21:08 UTC
New try with v.6.5.0.0.alpha0+, Build ID 0f8c70cf5803 (master~2020-01-08_08.06.17_LibreOfficeViewer-strippedUIEditing-debug.apk):

Results:
-------
LibreOffice Viewer: "Cannot connect to ownCloud server. Check your configuration." (I did check)
-------
nginx/access.log: unchanged
-------
owncloud.log:
{"reqId":"qwPUW0FMnI3v4nf12BOD","level":0,"time":"2020-01-08T10:49:54+01:00","remoteAddr":"192.168.11.11","user":"--","app":"OC\\Authentication\\Token\\DefaultTokenProvider::invalidateToken","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"invalidating token aa023882b897c11e8403cdbd5353f8c6617e478da360a1232f020a894a09ce7fb9321179601aaecdeebb13be37a1578431cccef54228c8a22129728149fd5c69"}

{"reqId":"qwPUW0FMnI3v4nf12BOD","level":0,"time":"2020-01-08T10:49:54+01:00","remoteAddr":"192.168.11.11","user":"--","app":"OC\\Authentication\\Token\\DefaultTokenProvider::getToken","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"token dd4a564a7d11ffdbd0c2370d55192d189e09088aa4867c602f345647371a6bf5e1faa08d1f965cb6ed56a776fa423e2bb01ccebc17924c7b1883a1bb89df7efd does not exist"}

{"reqId":"qwPUW0FMnI3v4nf12BOD","level":0,"time":"2020-01-08T10:49:54+01:00","remoteAddr":"192.168.11.11","user":"--","app":"OC\\User\\Session::login","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"regenerating session id for uid thomas, password set"}

{"reqId":"qwPUW0FMnI3v4nf12BOD","level":0,"time":"2020-01-08T10:49:54+01:00","remoteAddr":"192.168.11.11","user":"--","app":"OC\\Authentication\\Token\\DefaultTokenProvider::getToken","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"token dd4a564a7d11ffdbd0c2370d55192d189e09088aa4867c602f345647371a6bf5e1faa08d1f965cb6ed56a776fa423e2bb01ccebc17924c7b1883a1bb89df7efd does not exist"}

{"reqId":"qwPUW0FMnI3v4nf12BOD","level":0,"time":"2020-01-08T10:49:54+01:00","remoteAddr":"192.168.11.11","user":"--","app":"OC\\User\\Session::validateToken","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"token dd4a564a7d11ffdbd0c2370d55192d189e09088aa4867c602f345647371a6bf5e1faa08d1f965cb6ed56a776fa423e2bb01ccebc17924c7b1883a1bb89df7efd, not found"}

{"reqId":"AEcdKjuy1n3aQtrVSaFt","level":0,"time":"2020-01-08T10:49:55+01:00","remoteAddr":"192.168.11.11","user":"--","app":"OC\\Authentication\\Token\\DefaultTokenProvider::invalidateToken","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"invalidating token d86114a4c4177a85b137417b583a4fb680e1d416fb9757776c12fa278c2966ff0e897114bfb6947839a600937de1e3c8ac3127996533bb44aec8e84ad8aa2991"}

{"reqId":"AEcdKjuy1n3aQtrVSaFt","level":0,"time":"2020-01-08T10:49:55+01:00","remoteAddr":"192.168.11.11","user":"--","app":"OC\\Authentication\\Token\\DefaultTokenProvider::getToken","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"token dd4a564a7d11ffdbd0c2370d55192d189e09088aa4867c602f345647371a6bf5e1faa08d1f965cb6ed56a776fa423e2bb01ccebc17924c7b1883a1bb89df7efd does not exist"}

{"reqId":"AEcdKjuy1n3aQtrVSaFt","level":0,"time":"2020-01-08T10:49:55+01:00","remoteAddr":"192.168.11.11","user":"--","app":"OC\\User\\Session::login","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"regenerating session id for uid thomas, password set"}

{"reqId":"AEcdKjuy1n3aQtrVSaFt","level":0,"time":"2020-01-08T10:49:55+01:00","remoteAddr":"192.168.11.11","user":"--","app":"OC\\Authentication\\Token\\DefaultTokenProvider::getToken","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"token dd4a564a7d11ffdbd0c2370d55192d189e09088aa4867c602f345647371a6bf5e1faa08d1f965cb6ed56a776fa423e2bb01ccebc17924c7b1883a1bb89df7efd does not exist"}

{"reqId":"AEcdKjuy1n3aQtrVSaFt","level":0,"time":"2020-01-08T10:49:55+01:00","remoteAddr":"192.168.11.11","user":"--","app":"OC\\User\\Session::validateToken","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"token dd4a564a7d11ffdbd0c2370d55192d189e09088aa4867c602f345647371a6bf5e1faa08d1f965cb6ed56a776fa423e2bb01ccebc17924c7b1883a1bb89df7efd, not found"}

(blank lines inserted by myself for better readability)
Comment 3 Michael Weghorn 2020-02-14 14:50:50 UTC
I'm wondering whether it makes sense to implement/maintain a separate ownCloud connector in the LibreOffice Android app after all or it wouldn't make more sense to use Android's "system file dialog" to select files, which can be triggered via Intent.ACTION_OPEN_DOCUMENT. This way, everything for which a DocumentsProvider is available will be available, if the app is modified to support those.

That would mean that there's no need to implement support for all of the different providers (like ownCloud, NextCloud, Google Drive,...) separately, but those work "automatically" once the user has installed and configured the corresponding apps (like the NextCloud app for access to NextCloud, etc.).
Comment 4 Xisco Faulí 2020-11-11 15:00:47 UTC
Moving to NEW and changing to enhancement
Comment 5 Michael Weghorn 2021-03-17 09:52:40 UTC
*** Bug 117666 has been marked as a duplicate of this bug. ***
Comment 6 Michael Weghorn 2021-03-17 09:55:57 UTC
*** Bug 96786 has been marked as a duplicate of this bug. ***
Comment 7 Michael Weghorn 2021-03-19 16:13:43 UTC
(In reply to Michael Weghorn from comment #3)
> I'm wondering whether it makes sense to implement/maintain a separate
> ownCloud connector in the LibreOffice Android app after all or it wouldn't
> make more sense to use Android's "system file dialog" to select files, which
> can be triggered via Intent.ACTION_OPEN_DOCUMENT. This way, everything for
> which a DocumentsProvider is available will be available, if the app is
> modified to support those.
> 
> That would mean that there's no need to implement support for all of the
> different providers (like ownCloud, NextCloud, Google Drive,...) separately,
> but those work "automatically" once the user has installed and configured
> the corresponding apps (like the NextCloud app for access to NextCloud,
> etc.).

A series of patches implementing this is now in Gerrit, s.
https://gerrit.libreoffice.org/c/core/+/112769 and its parent changes.

I only quickly tested with Nextcloud and opening, editing and saving back files worked. When the connection to the Nextcloud server does not work properly (e.g. due to network issues,...), the app might "hang" for a while (but I didn't do any closer testing so far), which is one of the aspects that could probably be improved further if necessary (and somebody has the time + motivation to work on it).
Comment 8 Commit Notification 2021-03-22 06:56:31 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6012599e17206ee7be9a83477654e7bd194079c3

tdf#129833 android: Drop non-working ownCloud/nextCloud support

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2021-03-22 06:57:44 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2df8b776e635efc5e59aaf6c8a5a7f4c218d74d0

tdf#129833 android: Allow editing writable docs passed by Intent

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2021-03-22 06:58:56 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d678ee309b02b4cc8af29a097bf5053b8b1b4e06

tdf#129833 android: Allow opening files using system file picker

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2021-03-22 06:59:06 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7f838b73e85eb6f0a1dce4647650a5cf5f34ccd2

tdf#129833 android: Move reading file to separate thread

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Michael Weghorn 2021-03-22 07:07:46 UTC
(In reply to Michael Weghorn from comment #7)
> A series of patches implementing this is now in Gerrit, s.
> https://gerrit.libreoffice.org/c/core/+/112769 and its parent changes.

I've merged the patches now. Opening and editing files from ownCloud and nextCloud should work again starting with the next daily build from https://dev-builds.libreoffice.org/daily/master/Android-ARM@86-TDF/ **when the corresponding NextCloud/ownCloud app is installed in addition**.

I only quickly tested with a demo NextCloud instance myself.

Closing this bug as RESOLVED. In case you run into issues, please write it here (if it still doesn't work at all) or open new bug reports and leave a link here (if there is a specific aspect that doesn't work as you think it should).
Comment 13 Commit Notification 2021-03-23 05:56:06 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/76a30ac646faf1c638736c10e834bb7b0ed243ef

Related tdf#129833 android: Drop android.permission.INTERNET

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.