From 05312aadb840b9b402a5960f60d6062aac7af62a Mon Sep 17 00:00:00 2001 From: Markus Minichmayr Date: Sun, 17 Nov 2024 21:50:06 +0100 Subject: [PATCH 1/2] Fix cloning of Attendee, where we didn't preserve the Uri properties' `OriginalStrin` value. --- Ical.Net/DataTypes/Attendee.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Ical.Net/DataTypes/Attendee.cs b/Ical.Net/DataTypes/Attendee.cs index 3410bea6..37395ca4 100644 --- a/Ical.Net/DataTypes/Attendee.cs +++ b/Ical.Net/DataTypes/Attendee.cs @@ -253,7 +253,7 @@ public override void CopyFrom(ICopyable obj) if (obj is not Attendee atn) return; base.CopyFrom(obj); - Value = new Uri(atn.Value.ToString()); + Value = atn.Value; // String assignments create new instances CommonName = atn.CommonName; @@ -263,8 +263,8 @@ public override void CopyFrom(ICopyable obj) Rsvp = atn.Rsvp; - SentBy = atn.SentBy != null ? new Uri(atn.SentBy.ToString()) : null; - DirectoryEntry = atn.DirectoryEntry != null ? new Uri(atn.DirectoryEntry.ToString()) : null; + SentBy = atn.SentBy; + DirectoryEntry = atn.DirectoryEntry; } protected bool Equals(Attendee other) => Equals(SentBy, other.SentBy) From 8fe31c57265c87c746f388a7d309aed416877be4 Mon Sep 17 00:00:00 2001 From: Markus Minichmayr Date: Sun, 17 Nov 2024 21:51:31 +0100 Subject: [PATCH 2/2] 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. --- Ical.Net.Tests/SerializationTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Ical.Net.Tests/SerializationTests.cs b/Ical.Net.Tests/SerializationTests.cs index fa6f74f4..06996246 100644 --- a/Ical.Net.Tests/SerializationTests.cs +++ b/Ical.Net.Tests/SerializationTests.cs @@ -314,8 +314,8 @@ public void AttendeesSerialized() var evt = AttendeeTest.VEventFactory(); cal.Events.Add(evt); - // new Uri() creates lowercase for the "MAILTO:" part - // according to the RFC 2368 specification + // The casing of `MAILTO` is not in line with RFC 2368, but we should + // be able to deal with it nevertheless and preserve it the way it is. const string org = "MAILTO:james@example.com"; evt.Organizer = new Organizer(org); @@ -331,7 +331,7 @@ public void AttendeesSerialized() foreach (var a in evt.Attendees) { - var vals = GetValues(vEvt, "ATTENDEE", a.Value.ToString()); + var vals = GetValues(vEvt, "ATTENDEE", a.Value.OriginalString.ToString()); foreach (var v in new Dictionary { ["CN"] = a.CommonName,