Checklist
Baikal version
0.10.1
PHP version
8.1.32
Steps to reproduce
Baikal version: 0.10.1
Docker deployment: docker.io/ckulka/baikal:0.10.1
Database: Postgres v17.5
Davx5: 4.4.10-ose
Tested with curl command:
echo "BEGIN:VCALENDAR
VERSION:2.0
PRODID:DAVx5/4.4.10-ose ical4j/3.2.19 (org.fossify.calendar)
BEGIN:VEVENT
DTSTAMP:20250516T114141Z
UID:ecdec3bd-efa3-4f5e-96f9-3a64fca0b2dd
SUMMARY:Jane Doe's Birthday
DTSTART;VALUE=DATE:19660209
DTEND;VALUE=DATE:19660210
RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=1
STATUS:CONFIRMED
TRANSP:TRANSPARENT
BEGIN:VALARM
TRIGGER:-PT10M
ACTION:DISPLAY
DESCRIPTION:Jane Doe's Birthday
END:VALARM
END:VEVENT
END:VCALENDAR" > body.txt
curl --digest -u 'johndoe:johndoe' -X PUT https://dav.example.co.uk/dav.php/calendars/johndoe/e175af5b-b871-486a-b23b-2c8027c82f95/ecdec3bd-efa3-4f5e-96f9-3a64fca0b2dd.ics --data "$(cat body.txt)"
Expected behaviour
Create the calendar entries from before the Unix Epoch. Eg. in the example we have birthday in 1966 before the cutoff of 1 January 1970.
Current behaviour
HTTP Response
Response{protocol=h2, code=500, message=, url=https://dav.example.co.uk/dav.php/calendars/johndoe/e175af5b-b871-486a-b23b-2c8027c82f95/ecdec3bd-efa3-4f5e-96f9-3a64fca0b2dd.ics}
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:sabredav-version>4.7.0</s:sabredav-version>
<s:exception>PDOException</s:exception>
<s:message>SQLSTATE[23514]: Check violation: 7 ERROR: new row for relation "calendarobjects" violates check constraint "calendarobjects_firstoccurence_check"
DETAIL: Failing row contains (1375, BEGIN:VCALENDAR
VERSION:2.0
PRODID:DAVx5/4.4.10-ose ical4j/3.2..., ecdec3bd-efa3-4f5e-96f9-3a64fca0b2dd.ics, 5, 1747395699, 71c5bcdcf1be7006cd44e67265cf4995, 463, VEVENT, 0, 2145916800, ecdec3bd-efa3-4f5e-96f9-3a64fca0b2dd).</s:message>
</d:error>
Code
In composer.json of Baikal the following line references the sabre/dav library:
In the sabre/dav library we find the following lines which sets the variable firstOccurence:
https://github.com/sabre-io/dav/blob/7183a67c4c0f890be7d5ceec5331435db1987186/lib/CalDAV/Backend/PDO.php#L668-L669
When setting up Postgres we execute the db.sql file with the following configurations:
|
firstoccurence INT CHECK (firstoccurence > 0), |
The fix is relatively simple, we need to include zero as the constraing value as follows:
firstoccurence INT CHECK (firstoccurence >= 0),
Deeper issues
Moreover investigating this issue further it seems we need to find ways to fix the issue of negative timestamps being retrieved, I have raised the following issue sabre-io/dav#1588 in the library in question.
Checklist
Baikal version
0.10.1
PHP version
8.1.32
Steps to reproduce
Baikal version:
0.10.1Docker deployment:
docker.io/ckulka/baikal:0.10.1Database:
Postgres v17.5Davx5:
4.4.10-oseTested with curl command:
Expected behaviour
Create the calendar entries from before the Unix Epoch. Eg. in the example we have birthday in 1966 before the cutoff of 1 January 1970.
Current behaviour
HTTP Response
Code
In
composer.jsonof Baikal the following line references thesabre/davlibrary:Baikal/composer.json
Line 10 in 49b610c
In the
sabre/davlibrary we find the following lines which sets the variablefirstOccurence:https://github.com/sabre-io/dav/blob/7183a67c4c0f890be7d5ceec5331435db1987186/lib/CalDAV/Backend/PDO.php#L668-L669
When setting up Postgres we execute the
db.sqlfile with the following configurations:Baikal/Core/Resources/Db/PgSQL/db.sql
Line 40 in 49b610c
The fix is relatively simple, we need to include zero as the constraing value as follows:
Deeper issues
Moreover investigating this issue further it seems we need to find ways to fix the issue of negative timestamps being retrieved, I have raised the following issue sabre-io/dav#1588 in the library in question.