You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Nextcloud Android app uses the DAV api to check for existence of a file at several points. For this it does a HEAD request on the file path (/remote.php/dav/files/<user>/<file path>) and reads the HTTP response code.
Prior to Nextcloud 24.0.4, this worked as expected. However, in 24.0.4 a warning is logged to nextcloud.log every time a file is checked in this way and does not exist. This is a problem for server admins as it can create tremendous amounts of logspam: for example this will happen every time a user uploads a file as we check if it exists first. See nextcloud/android#10663 for details and more server logs.
{"reqId":"DmcdTsWS0sZzedqSNC19","level":2,"time":"2022-09-05T09:56:40+00:00","remoteAddr":"172.17.0.1","user":"admin","app":"no app in context","method":"HEAD","url":"/remote.php/dav/files/admin/asdsad","message":"File with name //asdsad could not be located","userAgent":"curl/7.84.0","version":"24.0.4.1","exception":{"Exception":"Sabre\\DAV\\Exception\\NotFound","Message":"File with name //asdsad could not be located","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Tree.php","line":78,"function":"getChild","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["asdsad"]},{"file":"/var/www/html/apps/dav/lib/DAV/ViewOnlyPlugin.php","line":74,"function":"getNodeForPath","class":"Sabre\\DAV\\Tree","type":"->","args":["files/admin/asdsad"]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"checkViewOnly","class":"OCA\\DAV\\DAV\\ViewOnlyPlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:GET",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":251,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"},false]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpHead","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:HEAD",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/lib/Server.php","line":358,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":166,"args":["/var/www/html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/apps/dav/lib/Connector/Sabre/Directory.php","Line":242,"message":"File with name //asdsad could not be located","exception":{},"CustomMessage":"File with name //asdsad could not be located"}}
Additional info
If there's a better way to check for file existence, please let us know.
AlvaroBrey
changed the title
[Bug]: HEAD on nonexistent paths logs warning to Nextcloud log
[Bug]: 24.0.4: HEAD on nonexistent paths logs warning to Nextcloud log
Sep 5, 2022
Bug description
The Nextcloud Android app uses the DAV api to check for existence of a file at several points. For this it does a
HEAD
request on the file path (/remote.php/dav/files/<user>/<file path>
) and reads the HTTP response code.Prior to Nextcloud 24.0.4, this worked as expected. However, in 24.0.4 a warning is logged to
nextcloud.log
every time a file is checked in this way and does not exist. This is a problem for server admins as it can create tremendous amounts of logspam: for example this will happen every time a user uploads a file as we check if it exists first. See nextcloud/android#10663 for details and more server logs.Steps to reproduce
curl --head -u admin:<pass> <server IP>/remote.php/dav/files/admin/<random non-existing filename>
Expected behavior
No logs.
Installation method
Community Docker image
Operating system
Debian/Ubuntu
PHP engine version
No response
Web server
No response
Database engine version
SQlite
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
No response
What user-backends are you using?
Configuration report
No response
List of activated Apps
Nextcloud Signing status
No response
Nextcloud Logs
Additional info
If there's a better way to check for file existence, please let us know.
cc @tobiasKaminsky
The text was updated successfully, but these errors were encountered: