WebDav upload of .htacces files fail with InvalidPathException

Hi!
I’m trying to sync my “Back In Time”-Backup, placed on my synology NAS, with nextcloud over cloud sync. A lot has already been uploaded (63GB from 86GB)
but now it struggles with uploading three (3!) different .htaccess-files (as you can see in log entries below). Like all files in those backups file permission is 555.

Any help is highly appreciated!

Best regards

The output of Admin > Logging:

Debug	cron	Finished OCA\UpdateNotification\ResetTokenBackgroundJob job with ID 41 in 0 seconds	2017-12-03T14:59:19+0100
Debug	cron	Run OCA\UpdateNotification\ResetTokenBackgroundJob job with ID 41	2017-12-03T14:59:19+0100
Fatal	webdav	OCP\Files\InvalidPathException: 	2017-12-03T14:59:09+0100
Fatal	webdav	OCP\Files\InvalidPathException: 	2017-12-03T14:59:09+0100
Fatal	webdav	OCP\Files\InvalidPathException: 	2017-12-03T14:59:09+0100
Fatal	webdav	OCP\Files\InvalidPathException: 	2017-12-03T14:59:05+0100
Fatal	webdav	OCP\Files\InvalidPathException: 	2017-12-03T14:59:04+0100
Fatal	webdav	OCP\Files\InvalidPathException: 	2017-12-03T14:59:04+0100
Fatal	webdav	OCP\Files\InvalidPathException: 	2017-12-03T14:59:00+0100
Fatal	webdav	OCP\Files\InvalidPathException: 	2017-12-03T14:58:59+0100
Fatal	webdav	OCP\Files\InvalidPathException: 	2017-12-03T14:58:59+0100
Fatal	webdav	OCP\Files\InvalidPathException: 	2017-12-03T14:58:56+0100
Fatal	webdav	OCP\Files\InvalidPathException: 	2017-12-03T14:58:54+0100
Fatal	webdav	OCP\Files\InvalidPathException: 	2017-12-03T14:58:54+0100

The output of Nextcloud log:

{"reqId":"KKkMB9VMi1tOciXWU7Un","level":4,"time":"2017-12-02T17:09:48+00:00","remoteAddr":"88.10.21.73","user":"proton","app":"webdav","method":"PUT","url":"\/remote.php\/webdav\/backintime\/lapbox\/proton\/1\/20171130-093003-310\/backup\/home\/proton\/Projekte\/Programm\/html\/.htaccess","message":"Exception: {\"Exception\":\"OCP\\\\Files\\\\InvalidPathException\",\"Message\":\"\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/QuotaPlugin.php(147): OC\\\\Files\\\\View->free_space('backintime\\\/lapb...')\\n#1 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/QuotaPlugin.php(108): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\QuotaPlugin->getFreeSpace('\\\/backintime\\\/lap...')\\n#2 [internal function]: OCA\\\\DAV\\\\Connector\\\\Sabre\\\\QuotaPlugin->checkQuota('\\\/backintime\\\/lap...', Resource id #75, Object(OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Directory), false)\\n#3 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#4 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1094): Sabre\\\\Event\\\\EventEmitter->emit('beforeCreateFil...', Array)\\n#5 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(525): Sabre\\\\DAV\\\\Server->createFile('backintime\\\/lapb...', Resource id #75, NULL)\\n#6 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpPut(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#7 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#8 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:PUT', Array)\\n#9 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#10 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(76): Sabre\\\\DAV\\\\Server->exec()\\n#11 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/remote.php(162): require_once('\\\/var\\\/www\\\/vhosts...')\\n#12 {main}\",\"File\":\"\\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/lib\\\/private\\\/Files\\\/View.php\",\"Line\":1090}","userAgent":"--","version":"12.0.3.3"}

{"reqId":"U8t29oFzyI0dKvOW60gu","level":4,"time":"2017-12-02T17:09:49+00:00","remoteAddr":"88.10.21.73","user":"proton","app":"webdav","method":"PUT","url":"\/remote.php\/webdav\/backintime\/lapbox\/proton\/1\/20171130-093003-310\/backup\/home\/proton\/Projekte\/Server\/Sicherung\/.htaccess","message":"Exception: {\"Exception\":\"OCP\\\\Files\\\\InvalidPathException\",\"Message\":\"\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/QuotaPlugin.php(147): OC\\\\Files\\\\View->free_space('backintime\\\/lapb...')\\n#1 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/QuotaPlugin.php(108): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\QuotaPlugin->getFreeSpace('\\\/backintime\\\/lap...')\\n#2 [internal function]: OCA\\\\DAV\\\\Connector\\\\Sabre\\\\QuotaPlugin->checkQuota('\\\/backintime\\\/lap...', Resource id #75, Object(OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Directory), false)\\n#3 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#4 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1094): Sabre\\\\Event\\\\EventEmitter->emit('beforeCreateFil...', Array)\\n#5 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(525): Sabre\\\\DAV\\\\Server->createFile('backintime\\\/lapb...', Resource id #75, NULL)\\n#6 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpPut(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#7 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#8 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:PUT', Array)\\n#9 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#10 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(76): Sabre\\\\DAV\\\\Server->exec()\\n#11 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/remote.php(162): require_once('\\\/var\\\/www\\\/vhosts...')\\n#12 {main}\",\"File\":\"\\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/lib\\\/private\\\/Files\\\/View.php\",\"Line\":1090}","userAgent":"--","version":"12.0.3.3"}

{"reqId":"3C0RAcilNwsDEx7ktFXP","level":4,"time":"2017-12-02T17:09:49+00:00","remoteAddr":"88.10.21.73","user":"proton","app":"webdav","method":"PUT","url":"\/remote.php\/webdav\/backintime\/lapbox\/proton\/1\/20171130-093003-310\/backup\/home\/proton\/Projekte\/Server\/gvm\/.htaccess","message":"Exception: {\"Exception\":\"OCP\\\\Files\\\\InvalidPathException\",\"Message\":\"\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/QuotaPlugin.php(147): OC\\\\Files\\\\View->free_space('backintime\\\/lapb...')\\n#1 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/QuotaPlugin.php(108): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\QuotaPlugin->getFreeSpace('\\\/backintime\\\/lap...')\\n#2 [internal function]: OCA\\\\DAV\\\\Connector\\\\Sabre\\\\QuotaPlugin->checkQuota('\\\/backintime\\\/lap...', Resource id #75, Object(OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Directory), false)\\n#3 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#4 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1094): Sabre\\\\Event\\\\EventEmitter->emit('beforeCreateFil...', Array)\\n#5 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(525): Sabre\\\\DAV\\\\Server->createFile('backintime\\\/lapb...', Resource id #75, NULL)\\n#6 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpPut(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#7 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#8 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:PUT', Array)\\n#9 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#10 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(76): Sabre\\\\DAV\\\\Server->exec()\\n#11 \\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/remote.php(162): require_once('\\\/var\\\/www\\\/vhosts...')\\n#12 {main}\",\"File\":\"\\\/var\\\/www\\\/vhosts\\\/big.deal\\\/nextcloud.big.deal\\\/lib\\\/private\\\/Files\\\/View.php\",\"Line\":1090}","userAgent":"--","version":"12.0.3.3"}

Nextcloud version: 12.0.3.3
Operating system and version: Ubuntu 16.04)
PHP version: 7.0

config.php:
<?php
$CONFIG = array (
‘instanceid’ => ‘007’,
‘passwordsalt’ => ‘pepper’,
‘secret’ => ‘topsecret’,
‘trusted_domains’ =>
array (
0 => ‘nextcloud.big.deal’,
),
‘datadirectory’ => ‘/opt/nextcloud/data’,
‘overwrite.cli.url’ => ‘https://nextcloud.big.deal’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘12.0.3.3’,
‘dbname’ => ‘nextcloud’,
‘dbhost’ => ‘localhost’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘mysql.utf8mb4’ => true,
‘dbuser’ => ‘admin’,
‘dbpassword’ => ‘moresecret’,
‘installed’ => true,
‘maintenance’ => false,
‘theme’ => ‘’,
‘loglevel’ => 0,
‘updater.release.channel’ => ‘stable’,
);

I’m sorry, my searching before posting here was very poor.
It seems like it’s the desired behavior to prevent uploading .htaccess files.
Now I’m looking for a workaround, because every Snapshot contains those files
and I don’t want to rename or delete them manually, because I’m afraid to break something.

Best regards

Its asecurity measure which you should not violate. Pack them into zips or tars or theat them separtaley. You can override this, somehow, i will not guide you, and in general it is not recommended.

1 Like

Okay, thanks! I decided to rename those files and make a new backup.
I think reading .htaccess-files should be disabled by default, but that’s how it is now. :smirk:

You can configure your server in a way that it is still secure to upload .htaccess files. But if this is not done properly, you create a security risk and in some environments (hosted webspace) you don’t have enough control over the configuration. It could perhaps be discussed to enable it on external storage if you want to manage websites through nextcloud as well.

Nextcloud is installed on my dedicated server and data folder is outsourced to /opt/.
Could this be enough to make it save?

If you don’t have any document-root pointing to /opt/, it should be enough.