Android: Can't upload files for android app

Created on 24 Jun 2018  路  5Comments  路  Source: nextcloud/android

Actual behaviour

  • After switching server from 12 to 13 version, mobile clients can't upload files to server. Downloading and browser files are working.

Configuration server:

ubuntu 16.04, nginx/1.13.12, PHP-FPM 7.0.30 wo apache

Configuration for nginx https://pastebin.com/QdBsQJxH
Configuration for php.ini https://pastebin.com/7QbfXUQQ
Configuration for php-fpm https://pastebin.com/qR8Ngkua

Environment data

Android version:

Device model:
Xiaomi Mi MAX 2

Stock or customized system:
Stock, 7.1.1 NMF26F 2018-05-01

Nextcloud app version:
3.2.0

Nextcloud server version:
13.0.4

Logs

Web server error log

No errors in log files in nginx error.log and php-fpm error.log

Nextcloud log (data/nextcloud.log)

Debug webdav Sabre\DAV\Exception\NotFound: File with name IMG_20180620_032357 (2).jpg could not be located
/var/www/xxxxxxx/data/www/clxxxxxxx.ru/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 81: OCA\DAV\Connector\Sabre\ObjectTree->getNodeForPath('IMG_20180620_03...')
[internal function] Sabre\DAV\CorePlugin->httpGet(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/xxxxxxx/data/www/clxxxxxxx.ru/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/xxxxxxx/data/www/clxxxxxxx.ru/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method GET', Array)
/var/www/xxxxxxx/data/www/clxxxxxxx.ru/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 258: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response), false)
[internal function] Sabre\DAV\CorePlugin->httpHead(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/xxxxxxx/data/www/clxxxxxxx.ru/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/xxxxxxx/data/www/clxxxxxxx.ru/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method HEAD', Array)
/var/www/xxxxxxx/data/www/clxxxxxxx.ru/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/xxxxxxx/data/www/clxxxxxxx.ru/apps/dav/appinfo/v1/webdav.php - line 80: Sabre\DAV\Server->exec()
/var/www/xxxxxxx/data/www/clxxxxxxx.ru/remote.php - line 164: require_once('/var/www/xxxxxxx...')
{main}
bug

Most helpful comment

Ok, i find it.

  1. Enable access log.
  2. Found in:
 - test [02/Jul/2018:09:37:58 +0300] "HEAD /core/templates/404.php HTTP/1.1" 302 0 "-" "Mozilla/5.0 (Android) ownCloud-android/3.2.0"
 - test [02/Jul/2018:09:37:58 +0300] "HEAD /apps/files/ HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Android) ownCloud-android/3.2.0"
 - test [02/Jul/2018:09:37:58 +0300] "HEAD /remote.php/webdav/Screenshot_2018-07-02-07-26-24-735_com.nextcloud.client%20(15).png HTTP/1.1" 302 0 "-" "Mozilla/5.0 (Android) ownCloud-android/3.2.0"
  1. Delete in the nginx server config this:
error_page 403 https://cxxxx.ru/core/templates/403.php;
error_page 404 https://cxxxx.ru/core/templates/404.php;
  1. ...it works! Files uploaded!

Thank you all for your help!

All 5 comments

AHA! Application try method "Dav - PROPFIND" to upload file. i try method "Dav - PUT", and so... OK! Image uploaded! Maybe, nginx configuration not correct?
And app owncloud - upload file, app nextcloud - not. Logs:

App = owncloud

{"reqId":"xxx","level":0,"time":"2018-06-24T04:39:46+03:00","remoteAddr":"xx.xx.xx.xx","user":"user","app":"webdav","method":"PROPFIND","url":"\/remote.php\/webdav\/IMG_20180624_043945.jpg","message":"Exception: {\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotFound\",\"Message\":\"File with name IMG_20180624_043945.jpg could not be located\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(967): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\ObjectTree->getNodeForPath('IMG_20180624_04...')\\n#1 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1666): Sabre\\\\DAV\\\\Server->getPropertiesIteratorForPath('IMG_20180624_04...', Array, 0)\\n#2 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(359): Sabre\\\\DAV\\\\Server->generateMultiStatus(Object(Generator), false)\\n#3 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpPropFind(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#5 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:PROPFIND', Array)\\n#6 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#7 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(80): Sabre\\\\DAV\\\\Server->exec()\\n#8 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/remote.php(164): require_once('\\\/var\\\/www\\\/user...')\\n#9 {main}\",\"File\":\"\\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/ObjectTree.php\",\"Line\":174}","userAgent":"Mozilla\/5.0 (Android) ownCloud-android\/2.7.0","version":"13.0.4.0"}
{"reqId":"lWmdrPwUNJ1SlrSJIDk2","level":1,"time":"2018-06-24T04:39:49+03:00","remoteAddr":"xx.xx.xx.xx","user":"user","app":"admin_audit","method":"PUT","url":"\/remote.php\/webdav\/IMG_20180624_043945.jpg-chunking-2363-4-3","message":"File created: \"\/\/IMG_20180624_043945.jpg\"","userAgent":"Mozilla\/5.0 (Android) ownCloud-android\/2.7.0","version":"13.0.4.0"}
{"reqId":"lWmdrPwUNJ1SlrSJIDk2","level":1,"time":"2018-06-24T04:39:49+03:00","remoteAddr":"xx.xx.xx.xx","user":"user","app":"admin_audit","method":"PUT","url":"\/remote.php\/webdav\/IMG_20180624_043945.jpg-chunking-2363-4-3","message":"File written to: \"\/\/IMG_20180624_043945.jpg\"","userAgent":"Mozilla\/5.0 (Android) ownCloud-android\/2.7.0","version":"13.0.4.0"}
{"reqId":"UpHsAxgrsaNXzElnZJ58","level":1,"time":"2018-06-24T04:40:08+03:00","remoteAddr":"xx.xx.xx.xx","user":"user","app":"admin_audit","method":"GET","url":"\/remote.php\/dav\/files\/user\/IMG_20180624_043945.jpg","message":"File accessed: \"\/IMG_20180624_043945.jpg\"","userAgent":"Mozilla\/5.0 (Windows) mirall\/2.3.1 (build 8) (Nextcloud)","version":"13.0.4.0"}

App = Nextcloud

{"reqId":"xxx","level":0,"time":"2018-06-24T04:38:56+03:00","remoteAddr":"xx.xx.xx.xx","user":"user","app":"webdav","method":"HEAD","url":"\/remote.php\/webdav\/e2342d343t2345t45yt435y34y45y4ergfd51564651%20(10).jpg","message":"Exception: {\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotFound\",\"Message\":\"File with name e2342d343t2345t45yt435y34y45y4ergfd51564651 (10).jpg could not be located\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(81): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\ObjectTree->getNodeForPath('e2342d343t2345t...')\\n#1 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpGet(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#3 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:GET', Array)\\n#4 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(258): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response), false)\\n#5 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpHead(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#6 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#7 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:HEAD', Array)\\n#8 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#9 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(80): Sabre\\\\DAV\\\\Server->exec()\\n#10 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/remote.php(164): require_once('\\\/var\\\/www\\\/user...')\\n#11 {main}\",\"File\":\"\\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxxx.ru\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/ObjectTree.php\",\"Line\":174}","userAgent":"Mozilla\/5.0 (Android) ownCloud-android\/3.2.0","version":"13.0.4.0"}
{"reqId":"mMtDNUDdErnteGN4p2Ds","level":1,"time":"2018-06-24T04:38:57+03:00","remoteAddr":"xx.xx.xx.xx","user":"--","app":"admin_audit","method":"GET","url":"\/index.php\/204","message":"Login attempt: \"user\"","userAgent":"Mozilla\/5.0 (Android) ownCloud-android\/3.2.0","version":"13.0.4.0"}

@nextcloud/server-triage is there something special needed on nginx side for allowing propfind?

@nextcloud/server-triage is there something special needed on nginx side for allowing propfind?

By default not. But there are many different distribution tweak. Debian/Ubuntu works fine with the default config + our config - see https://docs.nextcloud.com/server/13/admin_manual/installation/nginx.html

I followed now configurated https://docs.nextcloud.com/server/13/admin_manual/installation/nginx.html PC web version work, but .... upload files don't work from android app. It seems that my configuration works the same as official nextcloud, but in the logs nothing has changed:

{"reqId":"1N89ivardOlsp8Ft9G8W","level":0,"time":"2018-06-25T23:34:44+03:00","remoteAddr":"xx.xx.xx.xx","user":"user","app":"webdav","method":"HEAD","url":"\/remote.php\/webdav\/Screenshot_2018-06-25-21-26-50-278_com.nextcloud.talk2%20(8).png","message":"Exception: {\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotFound\",\"Message\":\"File with name Screenshot_2018-06-25-21-26-50-278_com.nextcloud.talk2 (8).png could not be located\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(81): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\ObjectTree->getNodeForPath('Screenshot_2018...')\\n#1 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpGet(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxx.ru\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#3 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:GET', Array)\\n#4 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(258): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response), false)\\n#5 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpHead(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#6 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxx.ru\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#7 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:HEAD', Array)\\n#8 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxx.ru\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#9 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxx.ru\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(80): Sabre\\\\DAV\\\\Server->exec()\\n#10 \\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxx.ru\\\/remote.php(164): require_once('\\\/var\\\/www\\\/user...')\\n#11 {main}\",\"File\":\"\\\/var\\\/www\\\/user\\\/data\\\/www\\\/clxxxx.ru\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/ObjectTree.php\",\"Line\":174}","userAgent":"Mozilla\/5.0 (Android) ownCloud-android\/3.2.0","version":"13.0.4.0"}

Ok, i find it.

  1. Enable access log.
  2. Found in:
 - test [02/Jul/2018:09:37:58 +0300] "HEAD /core/templates/404.php HTTP/1.1" 302 0 "-" "Mozilla/5.0 (Android) ownCloud-android/3.2.0"
 - test [02/Jul/2018:09:37:58 +0300] "HEAD /apps/files/ HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Android) ownCloud-android/3.2.0"
 - test [02/Jul/2018:09:37:58 +0300] "HEAD /remote.php/webdav/Screenshot_2018-07-02-07-26-24-735_com.nextcloud.client%20(15).png HTTP/1.1" 302 0 "-" "Mozilla/5.0 (Android) ownCloud-android/3.2.0"
  1. Delete in the nginx server config this:
error_page 403 https://cxxxx.ru/core/templates/403.php;
error_page 404 https://cxxxx.ru/core/templates/404.php;
  1. ...it works! Files uploaded!

Thank you all for your help!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tobiasKaminsky picture tobiasKaminsky  路  3Comments

markbryanduncan picture markbryanduncan  路  3Comments

toobie83 picture toobie83  路  3Comments

JSoko picture JSoko  路  3Comments

JSoko picture JSoko  路  3Comments