Closed Bug 222711 Opened 21 years ago Closed 21 years ago

Editing mailing lists fails when display name has comma


(SeaMonkey :: MailNews: Address Book & Contacts, defect)

Not set


(Not tracked)



(Reporter: hackermw, Assigned: neil)




(1 file)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5) Gecko/20031007 Firebird/0.7

The editing routines for mailing lists appears to not handle display names with
commas correctly.  If a display name has a comma and you editing a mailing list
with that user listed then upon closing that entry is lost.  (If a list has user
"User, Test <>" upon exiting the list editor window the mail list
will contain only a entry for "User" with no associated email.  An card for
"User" with email "User" also gets created within the address book.

Reproducible: Always

Steps to Reproduce:
1.  Create an empty address book.
2.  Create an new card fill in as follows:
      First = "Test"
      Last = "User"
      Display = "User, Test"
      Email = ""
3.  Create a new list as follows:
      List Name = "Test List"
4.  Click on the arrow by the address book in the left pane so the mail list are
5.  From the top right pane drag and drop the card for "Test User" into the
"Test List" list showing in the left pane.  This should add the card into the list.
6.  Double click on the "Test List" list in the left pane.  This should open a
window that show the list name and all members.  On my machine this now displays
"User, Test <>" as the single member.
7.  Click the ok button.

Actual Results:  
A new card "User" with email address "User" is created.  The list now contains
just "User" when I double click on it.

Based on my testing it's the comma in the display name thats causing this.  If I
create cards with display names that have no comma then it works as expected.

Drag and dropping cards from a Ldap directory search into my personal address
book seems to create display names as "Last, First" however.  This means that
either I can't copy cards from Ldap or I can't use mailing lists.

Expected Results:  
Mozilla correclt interpret "User, Test <>" when it occurs in the
list editing window.  Alternatively it should only display email addresses in
said window.  If the email address is the key bit of information for the list
then the display name should be looked up when needed from the orginal card. 
Right now it appears that the list entry contains a copy of the display name (at
least it does when exported in ldif.)

This is from the Mac OS X Firebird build I recently install but I've had the
same problem on previous builds of Mozilla.  I've had several complaints from
various staff/faculty that I support that I now suspect arise from this problem.
 Is it possible to make cards copied from LDAP use a "FIRST LAST" display name?
 That would provide a level of work around.  (Once existing address books were
Confirmed yesterday that this issue occurs on version 1.4 under Windows 2000.
I confirm this happens in Thunderbird 0.3 as well.
Is there a relation between this bug and bug 201153?
Proposed solution:
Add quotes to the display names when filling the address items in the
So change line 317 of mailnews/addrbook/resources/content/abMailListDialog.js
  address = card.displayName + " <" + card.primaryEmail + ">";
  address = "\"" + card.displayName + "\"" + " <" + card.primaryEmail + ">";
A quick test of Thunderbird 0.3 (Mac) show that when manually creating a address
book card entry you can use quotes in both the 'Display Name' field and the
'Email' field.  Unless we can be sure that there will never be a double quote in
either field the proposed solution will still break.

It appears that I can create a address card "New Card" with double quotes around
the Display Name when manually entering the card.  If I add that card to a list
it gets added.  (drag and drop the card from the list of all cards to the list
in the left pane "list of all books")  If I then double click the list, which
brings up the list manager, and click ok the list manager window removes the
original double quotes AND edits the original card to be without quotes.

If, for example, I manually create a display name as "Hacker, Matthew" then the
first time I edit the list it turns into Hacker, Matthew and the second time I
edit it it breaks (because the comma is now exposed).

Curiously if I escape the double quote with a backslash ( Hac\"ker ) everything
works fine.

It seems as though adding double quotes as suggested will work _if_ double
quotes are not permitted (or only if escaped?) within these fields.  That's a
bit of trouble since I can think of multiple ways to get entries into the
address book.  (Netscape 4.x profile conversions, address book imports, copies
from LDAP, manual entry, pre-existing Mozilla profiles that already have double
quotes in them.)

I'm not really sure about where this should be handled.  It's a little
disturbing to be able to create an exported ldif file that looks like this:

dn: cn="Matthew, Hacker",mail=hack"""
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
objectclass: mozillaAbPersonObsolete
givenName: Hacker
sn: Mat\"thew
cn: "Matthew, Hacker"
mail: hack"""
modifytimestamp: 0Z

dn: cn=test list
objectclass: top
objectclass: groupOfNames
cn: test list
xmozillanickname: list
description: list
member: cn="Matthew, Hacker",mail=hack"""
The names should quote as per autocomplete (which gets it right).
Ever confirmed: true
Attached patch Proposed patchSplinter Review
This turned out to be quite simple to fix.
Attachment #137042 - Flags: superreview?(Henry.Jia)
Attachment #137042 - Flags: review?(mscott)
Attachment #137042 - Flags: review?(mscott) → review+
Attachment #137042 - Flags: superreview?(Henry.Jia) → superreview?(bienvenu)
Attachment #137042 - Flags: superreview?(bienvenu) → superreview+
Assignee: sspitzer →
Target Milestone: --- → mozilla1.7alpha
Fix checked in.
Closed: 21 years ago
Resolution: --- → FIXED
*** Bug 117846 has been marked as a duplicate of this bug. ***
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.