summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/connector/sabre/custompropertiesbackend.php16
-rw-r--r--lib/private/server.php29
-rw-r--r--tests/lib/connector/sabre/custompropertiesbackend.php28
3 files changed, 61 insertions, 12 deletions
diff --git a/lib/private/connector/sabre/custompropertiesbackend.php b/lib/private/connector/sabre/custompropertiesbackend.php
index 76ac8b84ef9..6827cb9ae0d 100644
--- a/lib/private/connector/sabre/custompropertiesbackend.php
+++ b/lib/private/connector/sabre/custompropertiesbackend.php
@@ -29,6 +29,7 @@ use Sabre\DAV\PropertyStorage\Backend\BackendInterface;
use Sabre\DAV\PropFind;
use Sabre\DAV\PropPatch;
use Sabre\DAV\Tree;
+use Sabre\DAV\Exception\NotFound;
class CustomPropertiesBackend implements BackendInterface {
@@ -94,8 +95,19 @@ class CustomPropertiesBackend implements BackendInterface {
* @return void
*/
public function propFind($path, PropFind $propFind) {
- $node = $this->tree->getNodeForPath($path);
- if (!($node instanceof Node)) {
+ try {
+ $node = $this->tree->getNodeForPath($path);
+ if (!($node instanceof Node)) {
+ return;
+ }
+ } catch (NotFound $e) {
+ // in some rare (buggy) cases the node might not be found,
+ // we catch the exception to prevent breaking the whole list with a 404
+ // (soft fail)
+ \OC::$server->getLogger()->warning(
+ 'Could not get node for path: \"' . $path . '\" : ' . $e->getMessage(),
+ array('app' => 'files')
+ );
return;
}
diff --git a/lib/private/server.php b/lib/private/server.php
index c55817bb6b3..4264c70905c 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -12,6 +12,7 @@ use OC\Diagnostics\NullQueryLogger;
use OC\Diagnostics\EventLogger;
use OC\Diagnostics\QueryLogger;
use OC\Mail\Mailer;
+use OC\Memcache\ArrayCache;
use OC\Security\CertificateManager;
use OC\Files\Node\Root;
use OC\Files\View;
@@ -159,17 +160,25 @@ class Server extends SimpleContainer implements IServerContainer {
$this->registerService('UserCache', function ($c) {
return new UserCache();
});
- $this->registerService('MemCacheFactory', function ($c) {
+ $this->registerService('MemCacheFactory', function (Server $c) {
$config = $c->getConfig();
- $v = \OC_App::getAppVersions();
- $v['core'] = implode('.', \OC_Util::getVersion());
- $version = implode(',', $v);
- $instanceId = \OC_Util::getInstanceId();
- $path = \OC::$SERVERROOT;
- $prefix = md5($instanceId.'-'.$version.'-'.$path);
- return new \OC\Memcache\Factory($prefix,
- $config->getSystemValue('memcache.local', null),
- $config->getSystemValue('memcache.distributed', null)
+
+ if($config->getSystemValue('installed', false)) {
+ $v = \OC_App::getAppVersions();
+ $v['core'] = implode('.', \OC_Util::getVersion());
+ $version = implode(',', $v);
+ $instanceId = \OC_Util::getInstanceId();
+ $path = \OC::$SERVERROOT;
+ $prefix = md5($instanceId.'-'.$version.'-'.$path);
+ return new \OC\Memcache\Factory($prefix,
+ $config->getSystemValue('memcache.local', null),
+ $config->getSystemValue('memcache.distributed', null)
+ );
+ }
+
+ return new \OC\Memcache\Factory('',
+ new ArrayCache(),
+ new ArrayCache()
);
});
$this->registerService('ActivityManager', function ($c) {
diff --git a/tests/lib/connector/sabre/custompropertiesbackend.php b/tests/lib/connector/sabre/custompropertiesbackend.php
index ee0c3c4e53d..8b6d1a90db1 100644
--- a/tests/lib/connector/sabre/custompropertiesbackend.php
+++ b/tests/lib/connector/sabre/custompropertiesbackend.php
@@ -102,6 +102,34 @@ class CustomPropertiesBackend extends \Test\TestCase {
}
/**
+ * Test that propFind on a missing file soft fails
+ */
+ public function testPropFindMissingFileSoftFail() {
+ $this->tree->expects($this->any())
+ ->method('getNodeForPath')
+ ->with('/dummypath')
+ ->will($this->throwException(new \Sabre\DAV\Exception\NotFound()));
+
+ $propFind = new \Sabre\DAV\PropFind(
+ '/dummypath',
+ array(
+ 'customprop',
+ 'customprop2',
+ 'unsetprop',
+ ),
+ 0
+ );
+
+ $this->plugin->propFind(
+ '/dummypath',
+ $propFind
+ );
+
+ // no exception, soft fail
+ $this->assertTrue(true);
+ }
+
+ /**
* Test setting/getting properties
*/
public function testSetGetPropertiesForFile() {