tchapi/davis

Can not remove object : Error 500

Closed this issue · 10 comments

I just try to remove an object and the error raised :
[2024-01-31T09:10:32.577610+01:00] app.ERROR: [500]: TypeError - Sabre\Uri\parse(): Argument #1 ($uri) must be of type string, null given, called in /data/home/cal/davis/vendor/sabre/dav/lib/DAVACL/PrincipalBackend/PDO.php on line 299 [{"file":"/data/home/cal/davis/vendor/sabre/dav/lib/DAVACL/PrincipalBackend/PDO.php","line":299,"function":"Sabre\\Uri\\parse"},{"file":"/data/home/cal/davis/vendor/sabre/dav/lib/DAVACL/AbstractPrincipalCollection.php","line":176,"function":"findByUri","class":"Sabre\\DAVACL\\PrincipalBackend\\PDO","type":"->"},{"file":"/data/home/cal/davis/vendor/sabre/dav/lib/DAVACL/Plugin.php","line":697,"function":"findByUri","class":"Sabre\\DAVACL\\AbstractPrincipalCollection","type":"->"},{"file":"/data/home/cal/davis/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php","line":417,"function":"getPrincipalByUri","class":"Sabre\\DAVACL\\Plugin","type":"->"},{"file":"/data/home/cal/davis/vendor/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"scheduleLocalDelivery","class":"Sabre\\CalDAV\\Schedule\\Plugin","type":"->"},{"file":"/data/home/cal/davis/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php","line":350,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/data/home/cal/davis/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php","line":396,"function":"deliver","class":"Sabre\\CalDAV\\Schedule\\Plugin","type":"->"},{"file":"/data/home/cal/davis/vendor/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"beforeUnbind","class":"Sabre\\CalDAV\\Schedule\\Plugin","type":"->"},{"file":"/data/home/cal/davis/vendor/sabre/dav/lib/DAV/CorePlugin.php","line":278,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/data/home/cal/davis/vendor/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpDelete","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/data/home/cal/davis/vendor/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/data/home/cal/davis/vendor/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/data/home/cal/davis/src/Controller/DAVController.php","line":329,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/data/home/cal/davis/vendor/symfony/http-kernel/HttpKernel.php","line":163,"function":"dav","class":"App\\Controller\\DAVController","type":"->"},{"file":"/data/home/cal/davis/vendor/symfony/http-kernel/HttpKernel.php","line":75,"function":"handleRaw","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"->"},{"file":"/data/home/cal/davis/vendor/symfony/http-kernel/Kernel.php","line":202,"function":"handle","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"->"},{"file":"/data/home/cal/davis/public/index.php","line":28,"function":"handle","class":"Symfony\\Component\\HttpKernel\\Kernel","type":"->"}] []

Thunderbird display an error regulary caused by the error code 500.

How can I solve this ?
Davis Version 4.4.1, MySQL Database, PHP8.2 FPM on Nginx server

Thanks

tchapi commented

Hello

I just try to remove an object and the error raised

Which object? How do you remove it?

Looks similar to sabre-io/Baikal#1147, so probably something in sabre/dav directly IMO

It was a calendar event. I try to delete it from Thunderbird. I am agree with you, the case looks like the provided link. But how should I solve it ? Thunderbird display the error popup regularly, because it tries to redo the action.

tchapi commented

I can't reproduce on macOS calendar on my side (I don't use Thunderbird).

Can you confirm that your principal has a non-null email?

I am sorry, but I don't know how I can check this. Do you have an idea how I can do that ?

tchapi commented

I am sorry, but I don't know how I can check this. Do you have an idea how I can do that ?

The user for this calendar, have you set an email for them?

Screenshot 2024-02-01 at 17 04 17

Thanks for the image. Yes the user has the email defined.

I just solve my problem with modifying the vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php file, at line 417 :

--- vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php.ori	2024-02-01 20:17:06.509023419 +0100
+++ vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php	2024-02-01 20:16:53.136307540 +0100
@@ -414,6 +414,9 @@
 
         $caldavNS = '{'.self::NS_CALDAV.'}';
 
+        if (is_null($iTipMessage->recipient)) {
+            return;
+        }
         $principalUri = $aclPlugin->getPrincipalByUri($iTipMessage->recipient);
         if (!$principalUri) {
             $iTipMessage->scheduleStatus = '3.7;Could not find principal.';

The event was with a null recipient.

tchapi commented

I reckon you should maybe make a PR against the sabre/dav repository so they include your fix!

I'll close this issue for now as the problem seems clearly identified on sabre/dav's side. I'll keep an eye on the underlying issue