Open thisIsTheFoxe opened 2 years ago
As I already assumed this comes from the Sabre implementation of WebDAV locking which generally blocks PROPPATCH if a write lock is active http://webdav.org/specs/rfc2518.html#rfc.section.7.1
Now the property of favourite is of course a custom one and unique per user, so the write lock for that could be skipped. A quick attempt for allowing only that didn't work out well, as the validation is handled way before the prop patch is even parsed, so this needs a bit more of thinking.
For later reference, just skipping validation for any PROPPATCH would work easily:
--- a/lib/DAV/LockPlugin.php
+++ b/lib/DAV/LockPlugin.php
@@ -6,6 +6,7 @@ use OCA\DAV\Connector\Sabre\CachingTree;
use OCA\DAV\Connector\Sabre\FakeLockerPlugin;
use OCA\DAV\Connector\Sabre\Node as SabreNode;
use OCA\DAV\Connector\Sabre\ObjectTree;
use OCA\FilesLock\AppInfo\Application;
use OCA\FilesLock\Exceptions\LockNotFoundException;
use OCA\FilesLock\Exceptions\UnauthorizedUnlockException;
@@ -25,6 +26,7 @@ use Sabre\DAV\Exception\LockTokenMatchesRequestUri;
use Sabre\DAV\INode;
use Sabre\DAV\Locks\Plugin as SabreLockPlugin;
use Sabre\DAV\PropFind;
+use Sabre\DAV\PropPatch;
use Sabre\DAV\Server;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
@@ -63,9 +65,23 @@ class LockPlugin extends SabreLockPlugin {
}
$this->locksBackend = new LockBackend($server, $this->fileService, $this->lockService, $absolute);
$server->on('propFind', [$this, 'customProperties']);
+ $server->on('propPatch', [$this, 'propPatch']);
parent::initialize($server);
}
+ public function validateTokens(RequestInterface $request, &$conditions) {
+ if ($request->getMethod() === 'PROPPATCH') {
+ return;
+ }
+ return parent::validateTokens($request, $conditions);
+ }
+
Related
27:
Steps
admin/Nextcloud Manual.pdf
Expected
Changing the favourite should still be possible using WebDAV. The web UI uses
POST /apps/files/api/v1/files/Nextcloud%20Manual.pdf
to change the favourite tag which still works as expected.Actual
423: Sabre\DAV\Exception\Locked
, see logsLogs: