Closed Bug 1647249 Opened 4 years ago Closed 4 years ago

Address book migration fails on "bad" mailing list name

Categories

(MailNews Core :: Address Book, defect)

defect

Tracking

(thunderbird78 fixed)

RESOLVED FIXED
Thunderbird 79.0
Tracking Status
thunderbird78 --- fixed

People

(Reporter: jorgk-bmo, Assigned: darktrojan)

Details

Attachments

(1 file)

I have a mailing list called "a, b, c" from ancient times. This made the AB migration from TB 68 to TB 78 fail.

I've mitigated this problem in two ways: put the list migration into a try/catch block so that one bad list doesn't prevent a migration, and converting invalid or duplicate list names into valid list names.

Assignee: nobody → geoff
Status: NEW → ASSIGNED
Attachment #9158401 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9158401 [details] [diff] [review]
1647249-migrate-bad-lists-1.diff

This could break address book migration, and we only really get one shot at that, so it has to be in 78.
Attachment #9158401 - Flags: approval-comm-beta?
Comment on attachment 9158401 [details] [diff] [review]
1647249-migrate-bad-lists-1.diff

Review of attachment 9158401 [details] [diff] [review]:
-----------------------------------------------------------------

r=mkmelin with the changes below

::: mail/base/modules/MailMigrator.jsm
@@ +781,5 @@
>        if (cardMap.size > 0) {
>          await newBook._bulkAddCards(cardMap.values());
>  
>          for (let card of database.enumerateCards(directory)) {
>            if (card.isMailList) {

could just do an early continue here

@@ +785,5 @@
>            if (card.isMailList) {
> +            try {
> +              let listName = card.displayName
> +                .trim()
> +                .replace(/  +/g, " ")

maybe use `.replace(/\s+/g, " ")` - I don't know if that's been (ever) possible to enter throuh

@@ +786,5 @@
> +            try {
> +              let listName = card.displayName
> +                .trim()
> +                .replace(/  +/g, " ")
> +                .replace(/[,;"<>]/g, "");

I think you want to do the double space replacements later, and the trimming last. Otherwise you could get double spaces due to removing junk.
Attachment #9158401 - Flags: review?(mkmelin+mozilla) → review+

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/a8766e0cda5d
Fix address book migration failure with invalid mailing list names. r=mkmelin DONTBUILD

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 79.0
Comment on attachment 9158401 [details] [diff] [review]
1647249-migrate-bad-lists-1.diff

Approved for beta.
good thing there are tests ;)
Attachment #9158401 - Flags: approval-comm-beta? → approval-comm-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: