sw/source/uibase/dbui/mailmergehelper.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 1ea95f05ee8ec496c628bd11750d23cc012c7fe4
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sat Apr 2 11:10:22 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Apr 3 20:48:47 2022 +0200

    tdf#148338: allow single-letter lowest-level domain
    
    The check that required lowest-level domain name to be at least
    two characters long, was introduced for #i25107# in 2004 in the
    commit dfcb4aa47b81ebd9affddefda88bf9b451508221
      Author Rüdiger Timm <r...@openoffice.org>
      Date   Mon Sep 20 12:13:22 2004 +0000
        INTEGRATION: CWS swmailmerge (1.1.2); FILE ADDED
    
    (See also related #i20057# for feature specification.)
    It didn't mention a rationale behind that check; but obviously,
    it's unjustified. There are single-letter second-level domain
    names [1], like 'x.com', and also under many other TLDs. Also
    the check prevented single-character third-level names like
    "a.foo.bar", etc. Plus, RFC 5322 (and its predecessors) do not
    restrict these lengths in 'Addr-Spec Specification' (and RFCs
    referenced from there).
    
    This does not enable dotless domains [2]; if justified, they
    should be enabled separately.
    
    [1] https://en.wikipedia.org/wiki/Single-letter_second-level_domain
    [2] https://en.wikipedia.org/wiki/Top-level_domain#Dotless_domains
    
    Change-Id: I03cc26a90c08b94b9c1f70e0a0f1746192cb7afe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132482
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx 
b/sw/source/uibase/dbui/mailmergehelper.cxx
index 03df98e9a192..edd125cb04a3 100644
--- a/sw/source/uibase/dbui/mailmergehelper.cxx
+++ b/sw/source/uibase/dbui/mailmergehelper.cxx
@@ -72,8 +72,9 @@ OUString CallSaveAsDialog(weld::Window* pParent, OUString& 
rFilter)
 
 /*
     simple address check: check for '@'
-                            for at least one '.' after the '@'
-                            and for at least two characters before and after 
the dot
+                            for at least one '.' after the '@',
+                            for at least one character before the dot
+                            and for at least two characters after the dot
 */
 bool CheckMailAddress( const OUString& rMailAddress )
 {
@@ -81,7 +82,7 @@ bool CheckMailAddress( const OUString& rMailAddress )
     if (nPosAt<0 || rMailAddress.lastIndexOf('@')!=nPosAt)
         return false;
     const sal_Int32 nPosDot = rMailAddress.indexOf('.', nPosAt);
-    return !(nPosDot<0 || nPosDot-nPosAt<3 || 
rMailAddress.getLength()-nPosDot<3);
+    return !(nPosDot<0 || nPosDot-nPosAt<2 || 
rMailAddress.getLength()-nPosDot<3);
 }
 
 uno::Reference< mail::XSmtpService > ConnectToSmtpServer(

Reply via email to