Repository navigation
Description
Hello,
If i want to sync a calendar event through CalDav from EmClient i got an Exception.
The problem is with table "oc_calendarobjects_props" and Sabre.
This function "apps/dav/lib/CalDAV/CalDavBackend.updateProperties()" try to save a UTF-8 converted text into db but they save only the first xy char of the text.
And this is the problem. Because after the Split of the text there is a chance of get Incorrect string.
Text:
Obchod pouze baby ideálně kolem 30ti možná po mateřské
Ohodnocení Obchodniček - dodržet parametry ale velmi motivační musí při dobrém výkonu dosáhnout 100% při vynikajícím 120%
Podřídit veškerou kontrolu kontrole parametrů
Co nejví
Expected decode:
\x4f\x62\x63\x68\x6f\x64\u20\x70\x6f\x75\x7a\x65\u20\x62\x61\x62\x79\u20\x69\x64\x65\xc3\xa1\x6c\x6e\xc4\x9b\u20\x6b\x6f\x6c\x65\x6d\u20\x33\x30\x74\x69\u20\x6d\x6f\xc5\xbe\x6e\xc3\xa1\u20\x70\x6f\u20\x6d\x61\x74\x65\xc5\x99\x73\x6b\xc3\xa9\x0a\x4f\x68\x6f\x64\x6e\x6f\x63\x65\x6e\xc3\xad\u20\x4f\x62\x63\x68\x6f\x64\x6e\x69\xc4\x8d\x65\x6b\u20\x2d\u20\x64\x6f\x64\x72\xc5\xbe\x65\x74\u20\x70\x61\x72\x61\x6d\x65\x74\x72\x79\u20\x61\x6c\x65\u20\x76\x65\x6c\x6d\x69\u20\x6d\x6f\x74\x69\x76\x61\xc4\x8d\x6e\xc3\xad\u20\x6d\x75\x73\xc3\xad\u20\x70\xc5\x99\x69\u20\x64\x6f\x62\x72\xc3\xa9\x6d\u20\x76\xc3\xbd\x6b\x6f\x6e\x75\u20\x64\x6f\x73\xc3\xa1\x68\x6e\x6f\x75\x74\u20\x31\x30\x30\x25\u20\x70\xc5\x99\x69\u20\x76\x79\x6e\x69\x6b\x61\x6a\xc3\xad\x63\xc3\xad\x6d\u20\x31\x32\x30\x25\x0a\x50\x6f\x64\xc5\x99\xc3\xad\x64\x69\x74\u20\x76\x65\xc5\xa1\x6b\x65\x72\x6f\x75\u20\x6b\x6f\x6e\x74\x72\x6f\x6c\x75\u20\x6b\x6f\x6e\x74\x72\x6f\x6c\x65\u20\x70\x61\x72\x61\x6d\x65\x74\x72\xc5\xaf\x0a\x43\x6f\u20\x6e\x65\x6a\x76\xc3\xad
Actual decode:
\x4f\x62\x63\x68\x6f\x64\x20\x70\x6f\x75\x7a\x65\x20\x62\x61\x62\x79\x20\x69\x64\x65\xc3\xa1\x6c\x6e\xc4\x9b\x20\x6b\x6f\x6c\x65\x6d\x20\x33\x30\x74\x69\x20\x6d\x6f\xc5\xbe\x6e\xc3\xa1\x20\x70\x6f\x20\x6d\x61\x74\x65\xc5\x99\x73\x6b\xc3\xa9\x0a\x4f\x68\x6f\x64\x6e\x6f\x63\x65\x6e\xc3\xad\x20\x4f\x62\x63\x68\x6f\x64\x6e\x69\xc4\x8d\x65\x6b\x20\x2d\x20\x64\x6f\x64\x72\xc5\xbe\x65\x74\x20\x70\x61\x72\x61\x6d\x65\x74\x72\x79\x20\x61\x6c\x65\x20\x76\x65\x6c\x6d\x69\x20\x6d\x6f\x74\x69\x76\x61\xc4\x8d\x6e\xc3\xad\x20\x6d\x75\x73\xc3\xad\x20\x70\xc5\x99\x69\x20\x64\x6f\x62\x72\xc3\xa9\x6d\x20\x76\xc3\xbd\x6b\x6f\x6e\x75\x20\x64\x6f\x73\xc3\xa1\x68\x6e\x6f\x75\x74\x20\x31\x30\x30\x25\x20\x70\xc5\x99\x69\x20\x76\x79\x6e\x69\x6b\x61\x6a\xc3\xad\x63\xc3\xad\x6d\x20\x31\x32\x30\x25\x0a\x50\x6f\x64\xc5\x99\xc3\xad\x64\x69\x74\x20\x76\x65\xc5\xa1\x6b\x65\x72\x6f\x75\x20\x6b\x6f\x6e\x74\x72\x6f\x6c\x75\x20\x6b\x6f\x6e\x74\x72\x6f\x6c\x65\x20\x70\x61\x72\x61\x6d\x65\x74\x72\xc5\xaf\x0a\x43\x6f\x20\x6e\x65\x6a\x76\xc3
And the problem is this char "\xc3" and the reason of "General error: 1366 Incorrect string value: '\xC3' for column 'value' at row 1"
Steps to reproduce
- Sync calendar with CalDav.
- Create new event with this text
"Obchod pouze baby ideálně kolem 30ti možná po mateřské
Ohodnocení Obchodniček - dodržet parametry ale velmi motivační musí při dobrém výkonu dosáhnout 100% při vynikajícím 120%
Podřídit veškerou kontrolu kontrole parametrů
Co nejví" - without quote - sync with server
Expected behaviour
save the event
Actual behaviour
Throw Exception.
Server configuration
Operating system:
Web server:
Database: MySql 5.7.15-9-log
PHP version: 7.1.6
Nextcloud version: 12.0.4
Updated from an older Nextcloud/ownCloud or fresh install:
2 Month old install
Activity
MorrisJobke commentedon Jan 2, 2018
cc @georgehrke
georgehrke commentedon Jan 3, 2018
@Priebojp Can you please provide proper log files?
Where exactly is that exception thrown? (File and line number)
Is there a stack trace available?
...
Priebojp commentedon Jan 3, 2018
nextcloud.log
Thank you.
georgehrke commentedon Jan 3, 2018
So it's not directly related to Sabre/DAV but simply a database error.
MorrisJobke commentedon Jan 3, 2018
Priebojp commentedon Jan 4, 2018
I think its a problem with how they save the text in DB.
Because the last character is "í" with UTF-8 code "\xc3\xad"
but the DB got only half of that character "\xc3"
Or this is what i see on my cloude.
How can i fix this problem? or is this realy a DB problem?
rullzer commentedon Jan 5, 2018
Could this not just be utf8 issue?
@Priebojp can you post the output of
Priebojp commentedon Jan 5, 2018
My whole DB is in utf8mb4.
Priebojp commentedon Jan 18, 2018
Any suggestion how can i fix it?
Example:
User1 has a Calendar1;
User2 has a Calendar2;
Both sides share the calendar
User1 create Event with User2 as Participants.
This is still ok and User1 see in his own calendar the event, and the shared Calendar2 too.
User2 same.
But after User1 change something in that Event User2 get this error message.
georgehrke commentedon Jan 18, 2018
We will have to use
mb_substringinstead of a simplesubstrhere: https://github.com/nextcloud/server/blob/master/apps/dav/lib/CalDAV/CalDavBackend.php#L2256What does the length of database fields refer to? Bytes or the actual number of characters, even if characters are 4 byte UTF characters?
maybe @nickvergessen knows ^
Priebojp commentedon Jan 18, 2018
Default length of "value" in table "oc_calendarobjects_props" is 255 i think.
i changed it to "varchar(500)" for test but it didnt help.
georgehrke commentedon Jan 18, 2018
@Priebojp yes, that's expected. The issue is not the database but the line of code i referenced.
nickvergessen commentedon Feb 8, 2018
hmm, indeed mb_* fixes this, I always thought intl would help there too...
Btw this is not a problem with the lenght, but with the invalid sequence
\xC3which is no valid 3-byte character. So it reports that the second part of the 4-byte character is missing.MorrisJobke commentedon Mar 9, 2018
@nickvergessen @georgehrke Will this be ready by later today or should we move it to 13.0.2? #8748
nickvergessen commentedon Mar 9, 2018
No, this needs a general solution for all places where we trim input before the database
Use multibyte substring
Use multibyte substring
Use multibyte substring
Use multibyte substring