-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix unescaping of URIs in VCard4 and mime type of images in converter #602
base: master
Are you sure you want to change the base?
Conversation
This is required for VCard4 (see test sample), as comma and semicolon may appear in URIs with scheme data.
Also added the mandatory escaping of commas in VCard4 prop values to the converter test samples.
Codecov Report
@@ Coverage Diff @@
## master #602 +/- ##
============================================
+ Coverage 98.53% 98.72% +0.19%
- Complexity 1865 1869 +4
============================================
Files 71 71
Lines 4157 5336 +1179
============================================
+ Hits 4096 5268 +1172
- Misses 61 68 +7
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
When converting to VCard v4, only X-ADDRESSBOOKSERVER-KIND=GROUP is converted to KIND=group currently. X-ADDRESSBOOKSERVER-KIND=INDIVIDUAL is kept in the vcard, although KIND=individual would be correct. Since this is the default, the property can also be dropped, as is done by vobject in the opposite direction (converting v4 to v3). Therefore, this fix will also drop the X-ADDRESSBOOKSERVER-KIND=INDIVIDUAL property. Test existing test was broken because it used the output of the v4->v3 conversion as input for the v3->v4 conversion, but since the property is dropped during the first conversion there is no explicit X-ADDRESSBOOKSERVER-KIND property in the input of the v3->v4 conversion. Test fixed as well.
Added another fix: Remove |
PHOTO:data:image/gif;base64,Zm9v | ||
PHOTO;X-PARAM=FOO:data:image/png;base64,Zm9v | ||
PHOTO;TYPE=HOME:data:image/jpeg;base64\\,Zm9v | ||
PHOTO:data:image/gif;base64\\,Zm9v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not change the existing test but add a new one so we keep backwards compatibility...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this because the vcard here is broken. The comma must be escaped in a Vcard v4 property value according to RFC 6350, section 3.4. The test logic does not detect it because vobject not care about the correct escaping when parsing this text, and the resulting parsed vobject is used for the comparison, not the text itself.
Nonetheless, I think the test data should not be malformed data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know whether existing clients might also send malformed requests?
Or existing scripts relied on this example
Lets see what others think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so there is no confusion: vobject will continue to parse an unescaped comma here as before, this is just a change in the test data. If you prefer to keep it malformed, no problem. I thought it would be better if the actual test samples are properly escaped as to not confuse the reader. Escaping of the commas in the test data I did only for this reason and is not required concerning my code changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, will it help to get this merged if I revert all unnecessary changes in the tests?
This PR fixes two issues encountered on a V4 VCard.
Tests adapted / extended accordingly.