Double quotes removed from attendees' email addresses after saving an event

RESOLVED WORKSFORME

Status

Calendar
General
--
major
RESOLVED WORKSFORME
7 years ago
6 years ago

People

(Reporter: JM, Unassigned)

Tracking

Lightning 1.0b2
1.0b5
x86
Mac OS X

Details

(Reporter)

Description

7 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7

When editing a new event in Lightning, if attendees whose email addresses contain quotes (like "John Does" <john.doe@company.com>) are stripped of their quotes once the event is closed using the "Save and Close" button.
This will break not only the attendee list on the event's summary page (and therefore the option of sending email to all attendees will parse the list wrongly), but it will also break fetching free/busy information the next time the event is opened, for example.

Reproducible: Always

Steps to Reproduce:
1. Create an event whose attendees have addresses like "John Doe" <john.doe@mail.com>
2. Save event
3. Re-open event by double-clicking in calendar view.
Actual Results:  
Quotes have been stripped from addresses, therefore free/busy fetching doesn't work anymore, as well as notifying the attendees via e-mail (SMTP refuses bad address), or trying to send an email to attendees via the event's summary dialog (the generated address list is a mix of names and valid email addresses).

Expected Results:  
Quotes must be preserved for correct generation of CalDAV requests, email notifications, etc. If they are removed it should be for display purposes only (although even that is debatable).

Using against a CalDAV server, with addresses coming from an LDAP directory.
(Reporter)

Updated

7 years ago
Version: unspecified → Lightning 1.0b2
(Reporter)

Comment 1

7 years ago
After some digging in Lightning's code, apparently the problem is in calendar-events-attendees.xml. In the code inside <property name="attendees">, there's this block:


 // break the list of potentially many attendees back into individual names
                  var emailAddresses = {};
                  var names = {};
                  var fullNames = {};

                  if (this.mHeaderParser) {
                      this.mHeaderParser.parseHeadersWithArray(fieldValue,
                                                               emailAddresses,
                                                               names,
                                                               fullNames);
                  } else {
                      emailAddresses.value = [ fieldValue ];
                      names.value = [];
                  }

If I comment out the first part of the if, then it works as expected.
And looking at nsMsgHeaderParser.cpp, where the parseHeadersWithArray function is defined, it will for sure strip the quotes off an address like the one I stated (curiously enough, if my LDAP directory returned the CN as "Doe, John" <email>, things would work, apparently, since the quotes aren't stripped in that case).

However, that stripped version then doesn't work correctly both on the main event dialog, as well as when sending the actual invite by SMTP or fetching free/busy via CalDAV.

So why is it being quote-stripped at this point? Is there a particular reason? Maybe the original CN name should be save to talk to email and calendar server, and use the unquoted one just for display?
(In reply to comment #1)
> So why is it being quote-stripped at this point? Is there a particular reason?
Probably its just the way the header parser works, for better display.

> Maybe the original CN name should be save to talk to email and calendar server,
> and use the unquoted one just for display?
Sounds reasonable. Do you think you could whip up a patch for this and attach it to this bug?

See https://developer.mozilla.org/en/creating_a_patch and be sure you are cloning the comm-central repository.

Comment 3

7 years ago
I think this issue is the same as reported in bug 492069.
Slightly different description but seems caused by the same problem.
See also bug 492069 comment 14.
(Reporter)

Comment 4

7 years ago
(In reply to comment #3)
> I think this issue is the same as reported in bug 492069.
> Slightly different description but seems caused by the same problem.
> See also bug 492069 comment 14.
Yes, I think they are the same issue. Although for me, my CN was never corrupted, Lightning just seemed to save just my email address every time.
Although, when I was looking at nsMsgHeaderParser.cpp, I was under the impression that only in the case where the person's name has a comma the code would work, because the comas wouldn't be stripped (maybe I'm just reading the code wrong).

In any case, commenting out the parsing like I mentioning in comment #1 doesn't fully work. If I do that then when an attendee replies, Lightning will again strip the quotes off, and we now have two duplicated attendees, one of them with no quotes!

I'll dig around to try and fully understand how the attendee structure is managed inside this dialog, and try and create a working patch. It will probably take a while, since I've never even built mozilla / tb before :)

Phillip, Decathlon - any pointers are appreciated.

Comment 5

6 years ago
bug #492069 has been solved.

JM, can you verify?
(Reporter)

Comment 6

6 years ago
Just verified w/ Thunderbird 6.0.2, Lightning 1.0b5. Works fine now - good job!
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WORKSFORME

Updated

6 years ago
Target Milestone: --- → 1.0b5
You need to log in before you can comment on or make changes to this bug.