Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Ehrke <georgehrke@users.noreply.github.com>2018-09-05 19:08:55 +0300
committerGitHub <noreply@github.com>2018-09-05 19:08:55 +0300
commit4173f9d5884a957597bebda2a0377fa9527cd63f (patch)
tree6aad7cd1245a5d6cd80ae842bc36ab2fbeb45ab7
parentb08f67085d7b4ab32dee7b7bfa5de69bcd368b1f (diff)
parent2bdc407a827105eb8d9a7501a21fec7facf1eda2 (diff)
Merge pull request #11071 from nextcloud/bugfix-stable14/10727
[stable14] remove LogicException, because it's also triggered with legitimate pa…
-rw-r--r--apps/dav/lib/CalDAV/Plugin.php14
-rw-r--r--apps/dav/lib/CardDAV/Plugin.php5
-rw-r--r--apps/dav/tests/unit/CalDAV/PluginTest.php6
3 files changed, 11 insertions, 14 deletions
diff --git a/apps/dav/lib/CalDAV/Plugin.php b/apps/dav/lib/CalDAV/Plugin.php
index f37d9c571a0..174930b2923 100644
--- a/apps/dav/lib/CalDAV/Plugin.php
+++ b/apps/dav/lib/CalDAV/Plugin.php
@@ -28,10 +28,16 @@ class Plugin extends \Sabre\CalDAV\Plugin {
const SYSTEM_CALENDAR_ROOT = 'system-calendars';
/**
- * @inheritdoc
+ * Returns the path to a principal's calendar home.
+ *
+ * The return url must not end with a slash.
+ * This function should return null in case a principal did not have
+ * a calendar home.
+ *
+ * @param string $principalUrl
+ * @return string|null
*/
- function getCalendarHomeForPrincipal($principalUrl):string {
-
+ function getCalendarHomeForPrincipal($principalUrl) {
if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) {
list(, $principalId) = \Sabre\Uri\split($principalUrl);
return self::CALENDAR_ROOT . '/' . $principalId;
@@ -44,8 +50,6 @@ class Plugin extends \Sabre\CalDAV\Plugin {
list(, $principalId) = \Sabre\Uri\split($principalUrl);
return self::SYSTEM_CALENDAR_ROOT . '/calendar-rooms/' . $principalId;
}
-
- throw new \LogicException('This is not supposed to happen');
}
}
diff --git a/apps/dav/lib/CardDAV/Plugin.php b/apps/dav/lib/CardDAV/Plugin.php
index cd303a394ed..59b9212ef07 100644
--- a/apps/dav/lib/CardDAV/Plugin.php
+++ b/apps/dav/lib/CardDAV/Plugin.php
@@ -39,10 +39,9 @@ class Plugin extends \Sabre\CardDAV\Plugin {
* Returns the addressbook home for a given principal
*
* @param string $principal
- * @return string
+ * @return string|null
*/
protected function getAddressbookHomeForPrincipal($principal) {
-
if (strrpos($principal, 'principals/users', -strlen($principal)) !== false) {
list(, $principalId) = \Sabre\Uri\split($principal);
return self::ADDRESSBOOK_ROOT . '/users/' . $principalId;
@@ -55,8 +54,6 @@ class Plugin extends \Sabre\CardDAV\Plugin {
list(, $principalId) = \Sabre\Uri\split($principal);
return self::ADDRESSBOOK_ROOT . '/system/' . $principalId;
}
-
- throw new \LogicException('This is not supposed to happen');
}
/**
diff --git a/apps/dav/tests/unit/CalDAV/PluginTest.php b/apps/dav/tests/unit/CalDAV/PluginTest.php
index 47190d583f0..87bf69c2805 100644
--- a/apps/dav/tests/unit/CalDAV/PluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/PluginTest.php
@@ -63,11 +63,7 @@ class PluginTest extends TestCase {
$this->assertSame($expected, $this->plugin->getCalendarHomeForPrincipal($input));
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage This is not supposed to happen
- */
public function testGetCalendarHomeForUnknownPrincipal() {
- $this->plugin->getCalendarHomeForPrincipal('FOO/BAR/BLUB');
+ $this->assertNull($this->plugin->getCalendarHomeForPrincipal('FOO/BAR/BLUB'));
}
}