Skip to content

Commit

Permalink
fixup! feat(dav): implement updating a principal's schedule-default-c…
Browse files Browse the repository at this point in the history
…alendar-URL
  • Loading branch information
st3iny committed Feb 27, 2024
1 parent d6b267f commit d7a272d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion apps/dav/lib/DAV/CustomPropertiesBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
use Sabre\DAV\Xml\Property\Complex;
use Sabre\DAV\Xml\Property\Href;
use Sabre\DAV\Xml\Property\LocalHref;
use Sabre\Xml\ParseException;
use Sabre\Xml\Service as XmlService;

use function array_intersect;
Expand Down Expand Up @@ -520,6 +521,10 @@ private function formatPath(string $path): string {
return $path;
}

/**
* @throws ParseException If parsing a \Sabre\DAV\Xml\Property\Complex value fails
* @throws DavException If the property value is invalid
*/
private function encodeValueForDatabase(string $path, string $name, mixed $value): array {
// Try to parse a more specialized property type first
if ($value instanceof Complex) {
Expand All @@ -534,7 +539,7 @@ private function encodeValueForDatabase(string $path, string $name, mixed $value
try {
$this->validateProperty($path, $name, $value);
} catch (DavException $e) {
throw new \Exception(
throw new DavException(
"Property \"$name\" has an invalid value: " . $e->getMessage(),
0,
$e,
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected function getProps(string $user, string $path) {
$data = [];
while ($row = $result->fetch()) {
$value = $row['propertyvalue'];
if ($row['valuetype'] === CustomPropertiesBackend::PROPERTY_TYPE_HREF) {
if ((int)$row['valuetype'] === CustomPropertiesBackend::PROPERTY_TYPE_HREF) {
$value = new Href($value);
}
$data[$row['propertyname']] = $value;
Expand Down

0 comments on commit d7a272d

Please sign in to comment.