diff --git a/lib/Property/Uri.php b/lib/Property/Uri.php index dce7bf4bb..3d3fa6f21 100644 --- a/lib/Property/Uri.php +++ b/lib/Property/Uri.php @@ -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; } } diff --git a/tests/VObject/Parser/XmlTest.php b/tests/VObject/Parser/XmlTest.php index 223b0f105..1ed1c83d9 100644 --- a/tests/VObject/Parser/XmlTest.php +++ b/tests/VObject/Parser/XmlTest.php @@ -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( << @@ -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" ); diff --git a/tests/VObject/Property/UriTest.php b/tests/VObject/Property/UriTest.php index edb7cc393..d0e75637b 100644 --- a/tests/VObject/Property/UriTest.php +++ b/tests/VObject/Property/UriTest.php @@ -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 = <<PHOTO->serialize(), + 'Comma is not escaped'); + } }