Skip to content

Conversation

@tcitworld
Copy link
Member

@tcitworld tcitworld commented Dec 18, 2023

Summary

Introduce a middleware repair step for calendar data before it's being saved or updated.

TODO

  • Add an appconfig to opt-in to the middleware repair step, as this could be quite heavy on the database
  • Add a test for the description repair step
  • Make it more generic to handle CardDAV data as well?

Checklist

@tcitworld tcitworld added 2. developing Work in progress feature: caldav Related to CalDAV internals labels Dec 18, 2023
@tcitworld tcitworld added this to the Nextcloud 29 milestone Dec 18, 2023
// Compare descriptions
$isSameDescription = (string) $oldObject->DESCRIPTION === (string) $newObject->DESCRIPTION;
$isSameXAltDesc = (string) $oldObject->{self::X_ALT_DESC_PROP_NAME} === (string) $newObject->{self::X_ALT_DESC_PROP_NAME};
$isSameAltRep = (string) $oldObject->DESCRIPTION['ALTREP'] === (string) $newObject->DESCRIPTION['ALTREP'];

Check failure

Code scanning / Psalm

InvalidCast

Sabre\VObject\Node cannot be cast to string
// Compare descriptions
$isSameDescription = (string) $oldObject->DESCRIPTION === (string) $newObject->DESCRIPTION;
$isSameXAltDesc = (string) $oldObject->{self::X_ALT_DESC_PROP_NAME} === (string) $newObject->{self::X_ALT_DESC_PROP_NAME};
$isSameAltRep = (string) $oldObject->DESCRIPTION['ALTREP'] === (string) $newObject->DESCRIPTION['ALTREP'];

Check failure

Code scanning / Psalm

InvalidCast

Sabre\VObject\Node cannot be cast to string

public function onCalendarObjectChange(?VCalendar $oldVCalendar, ?VCalendar $newVCalendar, bool &$modified): void {
$keyedOldComponents = [];
foreach ($oldVCalendar->children() as $child) {

Check notice

Code scanning / Psalm

PossiblyNullReference

Cannot call method children on possibly null value
if (!($child instanceof Component)) {
continue;
}
$keyedOldComponents[$child->UID] = $child;

Check notice

Code scanning / Psalm

PossiblyNullArrayOffset

Cannot access value on variable $keyedOldComponents[$child->UID] using possibly null offset Sabre\VObject\Property|null

class Plugin extends ServerPlugin {

private Server $server;

Check notice

Code scanning / Psalm

PropertyNotSetInConstructor

Property OCA\DAV\CalDAV\Repair\Plugin::$server is not defined in constructor of OCA\DAV\CalDAV\Repair\Plugin or in any private or final methods called in the constructor
}

public function registerRepairStep(string $repairStep): self {
$this->addRepairStep(new $repairStep);

Check notice

Code scanning / Psalm

InvalidStringClass

String cannot be used as a class
}

public function registerRepairStep(string $repairStep): self {
$this->addRepairStep(new $repairStep);

Check notice

Code scanning / Psalm

ArgumentTypeCoercion

Argument 1 of OCA\DAV\CalDAV\Repair\RepairStepFactory::addRepairStep expects OCA\DAV\CalDAV\Repair\IRepairStep, but parent type object provided
This was referenced Mar 12, 2024
This was referenced Mar 20, 2024
@skjnldsv skjnldsv mentioned this pull request Mar 28, 2024
81 tasks
@skjnldsv skjnldsv modified the milestones: Nextcloud 29, Nextcloud 30 Mar 28, 2024
This was referenced Jul 30, 2024
This was referenced Aug 5, 2024
@skjnldsv skjnldsv mentioned this pull request Aug 13, 2024
@skjnldsv skjnldsv removed this from the Nextcloud 30 milestone Aug 14, 2024
@skjnldsv skjnldsv added this to the Nextcloud 32 milestone Jan 30, 2025
This was referenced Aug 22, 2025
This was referenced Sep 2, 2025
This was referenced Sep 25, 2025
@skjnldsv skjnldsv modified the milestones: Nextcloud 32, Nextcloud 33 Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress feature: caldav Related to CalDAV internals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants