Duplicate Mailing Lists can be created inside Address Book when leading and trailing spaces are given.

VERIFIED FIXED

Status

SeaMonkey
MailNews: Address Book & Contacts
VERIFIED FIXED
13 years ago
13 years ago

People

(Reporter: malika.jaiswal, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 2 obsolete attachments)

V2
1.01 KB, patch
neil@parkwaycc.co.uk
: review+
Details | Diff | Splinter Review
1004 bytes, patch
neil@parkwaycc.co.uk
: review+
Bienvenu
: superreview+
Details | Diff | Splinter Review
(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050319
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050319

Lists can be created inside Adress Book when leading and trailing spaces are given.

Reproducible: Always

Steps to Reproduce:
1.Open an Address Book.
2.Create a List named "ABC" inside it.
3.Create another List with name "ABC" inside it . A message comes "Duplicate
Address List".
4.Create another List with name "ABC  " inside it. 
5. Create another List with name "  ABC" inside it. (see the spaces)

Actual Results:  
3 Mailing Listings with the same name are created.

Expected Results:  
Duplicate Lists should not be created.

Comment 1

13 years ago
confirming the bug on latest mozilla1.7.6 for OS/2.

Comment 2

13 years ago
 91     var canonicalNewListName = listname.toLowerCase();
 92     var canonicalOldListName = oldListName.toLowerCase();

replacing these lines with

 91     var canonicalNewListName = 
listname.toLowerCase().replace(/(^\s+)|(\s+$)/g, '');//abhi
 92     var canonicalOldListName =
oldListName.toLowerCase().replace(/(^\s+)|(\s+$)/g, '');//abhi

in file 
mailnews/ addrbook/ resources/ content/ abMailListDialog.js 
is fixing the problem for me.

Comment 3

13 years ago
confirming the bug on Mozilla 1.8b1 on Windows 2K SP4

Further if you rename the new address book (with spaces) and remove the leading
or trailing spaces then there is no warning about duplicate name. The duplicate
address book stays.

Comment 4

13 years ago
(In reply to comment #3)
> confirming the bug on Mozilla 1.8b1 on Windows 2K SP4
> 
> Further if you rename the new address book (with spaces) and remove the leading
> or trailing spaces then there is no warning about duplicate name. The duplicate
> address book stays.

I think you are talking about addressbook here we are discussing mailing list
problem. Your comment is valid in context of bugid#290024 or we can address
this problem separately.

Comment 5

13 years ago
when I was debugging thru the file abMailListDialog.js I found another
interesting thing that say I create a mailing list named "            ABC" now
if I create another list with name "ABC" it is not giving any popup or error
message. So I tried this 

185     if (GetListValue(mailList, true)) {
186        var parentDirectory = GetDirectoryFromURI(uri);
+          var name= mailList.dirName.replace(/(^\s+)|(\s+$)/g, '');//abhi
+          mailList.dirName=name;//abhi  
187        parentDirectory.addMailList(mailList);
188     }



- 251       gListCard.lastName = gEditList.dirName;
+ 251       gListCard.lastName = gEditList.dirName.replace(/(^\s+)|(\s+$)/g,
'');//abhi

and
252       gListCard.nickName = gEditList.listNickName;
253       gListCard.notes = gEditList.description;
254     }
+       var name= gEditList.dirName.replace(/(^\s+)|(\s+$)/g, '');//abhi
+       gEditList.dirName=name;//abhi    
  
and this thing is fixing the other problem.

Comment 6

13 years ago
Created attachment 180686 [details] [diff] [review]
patch
Attachment #180686 - Flags: review?(sspitzer)

Comment 7

13 years ago
Comment on attachment 180686 [details] [diff] [review]
patch

An mailing should be A mailing.
Attachment #180686 - Flags: superreview?(bienvenu)
Attachment #180686 - Flags: review?(sspitzer)
Attachment #180686 - Flags: review?(neil.parkwaycc.co.uk)
Summary: Duplicate Mailing Lists can be created inside Adress Book when leading and trailing spaces are given. → Duplicate Mailing Lists can be created inside Address Book when leading and trailing spaces are given.
Marking bug as confirmed, I agree with this one as a names like with trailing
spaces are hard to distinguish between in lists, and it looks like we may mess
sending up if lists have spaces on the end or beginning.
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 9

13 years ago
Comment on attachment 180686 [details] [diff] [review]
patch

>   if (listname.length == 0)
>   {
>     var alertText = gAddressBookBundle.getString("emptyListName");
>     alert(alertText);
>     return false;
>   }
This is the code that handles empty list names. So why did you add two sets of
new code instead of fixing this one?

>     if (GetListValue(mailList, true)) {
>+       var name=mailList.dirName.replace(/(^\s+)|(\s+$)/g, '');
>+       mailList.dirName=name;
Hasn't GetListValue already used the correct name? If not, why not? Same thing
later on in the patch.
Attachment #180686 - Flags: review?(neil.parkwaycc.co.uk) → review-
Created attachment 181494 [details] [diff] [review]
V2

This is improved version of patch.
Attachment #180686 - Attachment is obsolete: true
Attachment #181494 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 180686 [details] [diff] [review]
patch

Clearing now redundant review request flag.
Attachment #180686 - Flags: superreview?(bienvenu)

Updated

13 years ago
Assignee: sspitzer → mail

Comment 12

13 years ago
Comment on attachment 181494 [details] [diff] [review]
V2

Wow, that simplified the patch a bit! If that's all you need to resolve the bug
to your satisfaction then great :-)

>+  var listname = (document.getElementById('ListName').value).replace(/(^\s+)|(\s+$)/g, '');
r=me if you remove all the extra parentheses - while those around the
(document...value) are just ugly the ones in the regexp actually force the JS
engine to update the values of RegExp.$1 and RegExp.$2
Attachment #181494 - Flags: review?(neil.parkwaycc.co.uk) → review+
Created attachment 181757 [details] [diff] [review]
V3
Attachment #181757 - Flags: review?(neil.parkwaycc.co.uk)

Comment 14

13 years ago
Comment on attachment 181757 [details] [diff] [review]
V3

No, this is not what I meant; you didn't remove the parentheses in the regexp.
Attachment #181757 - Flags: review?(neil.parkwaycc.co.uk) → review-
yes I understood but by mistake I uploaded a wrong patch, I think this should be
ok with you.

var listname = document.getElementById('ListName').value.replace(/^\s+|\s+$/g, '');
Created attachment 181841 [details] [diff] [review]
right patch V2
Attachment #181757 - Attachment is obsolete: true
Attachment #181841 - Flags: review?(neil.parkwaycc.co.uk)

Updated

13 years ago
Attachment #181841 - Flags: review?(neil.parkwaycc.co.uk) → review+

Updated

13 years ago
Attachment #181841 - Flags: superreview?(mail)

Comment 17

13 years ago
Comment on attachment 181841 [details] [diff] [review]
right patch V2

mail@seamonkey.bugs is no real person...
Attachment #181841 - Flags: superreview?(mail) → superreview?(bienvenu)

Updated

13 years ago
Attachment #181841 - Flags: superreview?(bienvenu) → superreview+

Updated

13 years ago
Attachment #181841 - Flags: approval1.8b2?
Attachment #181841 - Flags: approval1.7.8?
Attachment #181841 - Flags: approval-l10n?
Attachment #181841 - Flags: approval-aviary1.1a?
Attachment #181841 - Flags: approval-aviary1.0.4?

Comment 18

13 years ago
Comment on attachment 181841 [details] [diff] [review]
right patch V2

a=asa for trunk landing
Attachment #181841 - Flags: approval1.8b2?
Attachment #181841 - Flags: approval1.8b2+
Attachment #181841 - Flags: approval-aviary1.1a?
Attachment #181841 - Flags: approval-aviary1.1a+
abhijeet, you don't need approval-l10n, and I doubt they will want the patch in
aviary 1.0.5 or 1.7.8 (the branches generally consist security fixes only)

approval1.8b2+ and approval-aviary1.1a1+ is good enough for checkin as long as
it's before the 1.8b2 release (sometime soon). Ask on #developers
(irc://irc.mozilla.org) or on this bug if you need someone to check it in for you.

Comment 20

13 years ago
Fix checked in.
Status: NEW → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → FIXED
Comment on attachment 181841 [details] [diff] [review]
right patch V2

Removing unused approval request flags, if we really should have them, please
flag them again, but I can't see a good reason.
Attachment #181841 - Flags: approval1.7.8?
Attachment #181841 - Flags: approval-l10n?
Attachment #181841 - Flags: approval-aviary1.0.5?
Verified FIXED, using the clear steps in comment 0 to check and prove that we
now alert the user that "  ABC", "ABC  ", and "ABC" are the same name.

Windows XP, build Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2)
Gecko/20050524, Seamonkey trunk.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.