Bug 336163 - autocompletion shows multiple entries for one contact with different quotes
Summary: autocompletion shows multiple entries for one contact with different quotes
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: composer (show other bugs)
Version: Git (master)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-13 09:45 UTC by Sandro Knauß
Modified: 2015-02-04 08:34 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 14.12.3


Attachments
patch from the kolab branch (4.09 KB, patch)
2015-01-12 18:58 UTC, Sandro Knauß
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sandro Knauß 2014-06-13 09:45:44 UTC
When typing a name you can get multiple results, that only differ in the quoutes they have:

John Doe <doe@example.com>
"John Doe" <doe@example.com>
"'John Doe'" <doe@example.com>

This is annoying and some versions are not allowed by RFC 2822.

The bug should be either fixed in  AddresseeLineEdit::addContact [kdepim]/libkdepim/addressline/addresslineedit or KPIMUtils::normalizedAddress [kdepimlibs]/kpimutils/email.

relevant part of the RFC 2822:

to              =       "To:" address-list CRLF
address-list    =       (address *("," address)) / obs-addr-list
address         =       mailbox / group
mailbox         =       name-addr / addr-spec
name-addr       =       [display-name] angle-addr
angle-addr      =       [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr
display-name    =       phrase
phrase          =       1*word / obs-phrase
word            =       atom / quoted-string

atom            =       [CFWS] 1*atext [CFWS]
atext           =       ALPHA / DIGIT / ; Any character except controls,
                        "!" / "#" /     ;  SP, and specials.
                        "$" / "%" /     ;  Used for atoms
                        "&" / "'" /
                        "*" / "+" /
                        "-" / "/" /
                        "=" / "?" /
                        "^" / "_" /
                        "`" / "{" /
                        "|" / "}" /
                        "~"

quoted-string   =       [CFWS]
                        DQUOTE *([FWS] qcontent) [FWS] DQUOTE
                        [CFWS]
qcontent        =       qtext / quoted-pair
qtext           =       NO-WS-CTL /     ; Non white space controls

                        %d33 /          ; The rest of the US-ASCII
                        %d35-91 /       ;  characters not including "\"
                        %d93-126        ;  or the quote character

quoted-pair     =       ("\" text) / obs-qp
text            =       %d1-9 /         ; Characters excluding CR and LF
                        %d11 /
                        %d12 /
                        %d14-127 /
                        obs-text
obs-qp          =       "\" (%d0-127)
obs-text        =       *LF *CR *(obs-char *LF *CR)
obs-char        =       %d0-9 / %d11 /          ; %d0-127 except CR and
                        %d12 / %d14-127         ;  LF


Reproducible: Always

Steps to Reproduce:
1. enter a name "Doe"
2. get mutliple results (from baloo)


Expected Results:  
only one valid result.

The bug #316036 is about different versions writing an email address. This one here cares about RFC and quotes.
Comment 1 Christian Mollekopf 2014-06-13 10:08:49 UTC
Note that the problem is not necessarily that multiple entires are shown (as covered by 316036), but rather that entires make it into the selection that are not actually valid email addresses, causing the email to be rejected by the server.

One reason is possibly faulty indexing of the addresses, perhaps there are others.

In any case it probably would make sense to ensure a selected email address is valid before copying into the mail, or even hiding it completely from the selection.

From the rfc excerpt I take a name has to be quoted if it contains spaces, otherwise not.
So valid would be:
"John Doe" <john@doe.com>
John <john@doe.com>
Comment 2 Sandro Knauß 2015-01-12 18:58:39 UTC
Created attachment 90368 [details]
patch from the kolab branch
Comment 3 Sandro Knauß 2015-01-12 19:00:29 UTC
Well at least I have created a patch, so actually if someone wants to take care to get it into- feel free. Otherwise it will come into kdepim if other patches from kolab will enter kdepim.
Comment 4 Laurent Montel 2015-02-04 08:34:33 UTC
Git commit 84a0945c2e0c00de317de50e7f0c9e0156d08071 by Montel Laurent.
Committed on 04/02/2015 at 08:33.
Pushed by mlaurent into branch 'KDE/4.14'.

Fix Bug 336163 - autocompletion shows multiple entries for one contact with different quotes

Adapt patch from Sandro Knauß to new baloocompletionemail class
+ unittest
etc.
FIXED-IN: 14.12.3

M  +1    -1    libkdepim/addressline/autotests/CMakeLists.txt
M  +10   -0    libkdepim/addressline/autotests/baloocompletionemailtest.cpp
M  +1    -0    libkdepim/addressline/autotests/baloocompletionemailtest.h
M  +40   -3    libkdepim/addressline/baloocompletionemail.cpp
M  +2    -1    libkdepim/addressline/baloocompletionemail.h

http://commits.kde.org/kdepim/84a0945c2e0c00de317de50e7f0c9e0156d08071