summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Connector/Sabre
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2019-11-13 14:54:22 +0100
committerBackportbot <backportbot-noreply@rullzer.com>2019-11-14 18:35:17 +0000
commitbfc9e50160a031a872b361d213be78d926f30674 (patch)
treed77ad263cd1a1910a4e199c08960262a34733f96 /apps/dav/tests/unit/Connector/Sabre
parentd5fc345d7058deccbc30ebc58ed47e39cc0d7b1b (diff)
downloadnextcloud-server-bfc9e50160a031a872b361d213be78d926f30674.tar.gz
nextcloud-server-bfc9e50160a031a872b361d213be78d926f30674.zip
re-acquired expired shared locks on large file uploads
during large file uploads, the shared lock that we get at the begining can expire leading to locked errors later on, instead of erroring, try to re-get the lock Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/dav/tests/unit/Connector/Sabre')
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FileTest.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
index 3e3e80f7525..c579a904260 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
@@ -1201,4 +1201,25 @@ class FileTest extends TestCase {
$this->assertEquals('new content', $view->file_get_contents('root/file.txt'));
}
+
+ public function testPutLockExpired() {
+ $view = new \OC\Files\View('/' . $this->user . '/files/');
+
+ $path = 'test-locking.txt';
+ $info = new \OC\Files\FileInfo(
+ '/' . $this->user . '/files/' . $path,
+ $this->getMockStorage(),
+ null,
+ ['permissions' => \OCP\Constants::PERMISSION_ALL],
+ null
+ );
+
+ $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+
+ // don't lock before the PUT to simulate an expired shared lock
+ $this->assertNotEmpty($file->put($this->getStream('test data')));
+
+ // afterMethod unlocks
+ $view->unlockFile($path, ILockingProvider::LOCK_SHARED);
+ }
}