Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions lib/Property/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ public function setRawMimeDirValue(string $val): void
public function getRawMimeDirValue(): string
{
if (is_array($this->value)) {
$value = $this->value[0];
} else {
$value = $this->value;
return $this->value[0];
}

return strtr($value, [',' => '\,']);
return $this->value;
}
}
6 changes: 5 additions & 1 deletion tests/VObject/Parser/XmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2126,6 +2126,10 @@ public function testRFC6350Section6Part5Part1(): void
*/
public function testRFC6350Section6Part5Part2(): void
{
/*
* Note: We do not expect the comma in the Uri value of the GEO property to
* be escaped
*/
self::assertXMLEqualsToMimeDir(
<<<XML
<?xml version="1.0" encoding="UTF-8"?>
Expand All @@ -2139,7 +2143,7 @@ public function testRFC6350Section6Part5Part2(): void
XML,
'BEGIN:VCARD'."\n".
'VERSION:4.0'."\n".
'GEO:geo:37.386013\,-122.082932'."\n".
'GEO:geo:37.386013,-122.082932'."\n".
'END:VCARD'."\n"
);

Expand Down
14 changes: 14 additions & 0 deletions tests/VObject/Property/UriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,18 @@ public function testAlwaysEncodeUriVCalendar(): void
$output = Reader::read($input)->serialize();
self::assertStringContainsString('URL;VALUE=URI:http://example.org/', $output);
}

public function testNoEscapeForDataValue()
{
$input = <<<VCARD_WRAP
BEGIN:VCARD
VERSION:4.0
PHOTO;VALUE=URI:data:image/jpeg;base64,MIICajCCAd
END:VCARD
VCARD_WRAP;
$vObject = Reader::read($input);
self::assertStringContainsString('data:image/jpeg;base64,MIICajCCAd',
$vObject->PHOTO->serialize(),
'Comma is not escaped');
}
}