Gpxpod not working correctly with LDAP users
After enabling gpxpod in my Nextcloud installation and trying to load a folder with GPX files, my nextcloud.log shows:
{"reqId":"AhpYALvzwtZT+n4z7phw","remoteAddr":"2001::dead:beef::8001","app":"PHP","message":"mkdir(): No such file or directory at \/srv\/www\/nextcloud11\/apps\/gpxpod\/controller\/pagecontroller.php#216","level":3,"time":"April 24, 2017 22:06:46","method":"POST","url":"\/index.php\/apps\/gpxpod\/getmarkers","user":"2656a3c0-30b2-1032-87fc-39f0a32f6069","version":"11.0.3.2"}
{"reqId":"AhpYALvzwtZT+n4z7phw","remoteAddr":"2001:dead:beef::8001","app":"PHP","message":"mkdir(): No such file or directory at \/srv\/www\/nextcloud11\/apps\/gpxpod\/controller\/pagecontroller.php#945","level":3,"time":"April 24, 2017 22:06:46","method":"POST","url":"\/index.php\/apps\/gpxpod\/getmarkers","user":"2656a3c0-30b2-1032-87fc-39f0a32f6069","version":"11.0.3.2"}
{"reqId":"AhpYALvzwtZT+n4z7phw","remoteAddr":"2001:dead:beef::8001","app":"PHP","message":"file_put_contents(\/data\/nextcloud\/2656a3c0-30b2-1032-87fc-39f0a32f6069\/files\/..\/cache\/1862661033\/Filename.gpx): failed to open stream: No such file or directory at \/srv\/www\/nextcloud11\/apps\/gpxpod\/controller\/pagecontroller.php#1069","level":3,"time":"April 24, 2017 22:06:46","method":"POST","url":"\/index.php\/apps\/gpxpod\/getmarkers","user":"2656a3c0-30b2-1032-87fc-39f0a32f6069","version":"11.0.3.2"}
{"reqId":"AhpYALvzwtZT+n4z7phw","remoteAddr":"2001:dead:beef::8001","app":"PHP","message":"file_put_contents(\/data\/nextcloud\/2656a3c0-30b2-1032-87fc-39f0a32f6069\/files\/..\/cache\/1862661033\/20160601_132641.gpx): failed to open stream: No such file or directory at \/srv\/www\/nextcloud11\/apps\/gpxpod\/controller\/pagecontroller.php#1069","level":3,"time":"April 24, 2017 22:06:46","method":"POST","url":"\/index.php\/apps\/gpxpod\/getmarkers","user":"2656a3c0-30b2-1032-87fc-39f0a32f6069","version":"11.0.3.2"}
After that the log gets flooded with the following, which keeps going until the PHP-FPM daemon has been restarted.
{"reqId":"AhpYALvzwtZT+n4z7phw","remoteAddr":"2001:dead:beef::8001","app":"PHP","message":"readdir() expects parameter 1 to be resource, boolean given at \/srv\/www\/nextcloud\/apps\/gpxpod\/controller\/pagecontroller.php#121","level":3,"time":"April 24, 2017 22:06:55","method":"POST","url":"\/index.php\/apps\/gpxpod\/getmarkers","user":"2656a3c0-30b2-1032-87fc-39f0a32f6069","version":"11.0.3.2"}
The cause of this seems to be the handling of LDAP users. I've changed the User Home Folder Naming Rule to uid (login name) instead of the UUID. As you can see in the error messages, the app is trying to access a folder named after the UUID which doesn't exist. Symlinking the UUID to the data folder of the corresponding user resolves the errors as a workaround.