Skip to content

Commit e76da82

Browse files
authored
Fix copying of Attendees Uri-typed properties (#643)
* Fix cloning of Attendee, where we didn't preserve the Uri properties' `OriginalStrin` value. * Test: Adjust AttendeesSerialized to the implemented behavior of `Attendee`, which is to keep the casing of the `Uri` typed properties, even if not in line with the RFC.
1 parent fedbd4f commit e76da82

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Ical.Net.Tests/SerializationTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@ public void AttendeesSerialized()
314314

315315
var evt = AttendeeTest.VEventFactory();
316316
cal.Events.Add(evt);
317-
// new Uri() creates lowercase for the "MAILTO:" part
318-
// according to the RFC 2368 specification
317+
// The casing of `MAILTO` is not in line with RFC 2368, but we should
318+
// be able to deal with it nevertheless and preserve it the way it is.
319319
const string org = "MAILTO:[email protected]";
320320
evt.Organizer = new Organizer(org);
321321

@@ -331,7 +331,7 @@ public void AttendeesSerialized()
331331

332332
foreach (var a in evt.Attendees)
333333
{
334-
var vals = GetValues(vEvt, "ATTENDEE", a.Value.ToString());
334+
var vals = GetValues(vEvt, "ATTENDEE", a.Value.OriginalString.ToString());
335335
foreach (var v in new Dictionary<string, string>
336336
{
337337
["CN"] = a.CommonName,

Ical.Net/DataTypes/Attendee.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public override void CopyFrom(ICopyable obj)
253253
if (obj is not Attendee atn) return;
254254
base.CopyFrom(obj);
255255

256-
Value = new Uri(atn.Value.ToString());
256+
Value = atn.Value;
257257

258258
// String assignments create new instances
259259
CommonName = atn.CommonName;
@@ -263,8 +263,8 @@ public override void CopyFrom(ICopyable obj)
263263

264264
Rsvp = atn.Rsvp;
265265

266-
SentBy = atn.SentBy != null ? new Uri(atn.SentBy.ToString()) : null;
267-
DirectoryEntry = atn.DirectoryEntry != null ? new Uri(atn.DirectoryEntry.ToString()) : null;
266+
SentBy = atn.SentBy;
267+
DirectoryEntry = atn.DirectoryEntry;
268268
}
269269

270270
protected bool Equals(Attendee other) => Equals(SentBy, other.SentBy)

0 commit comments

Comments
 (0)