You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2018/07/29 17:04:05 UTC

[whimsy] branch master updated: Better matching of multiple word names

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 42c7993  Better matching of multiple word names
42c7993 is described below

commit 42c7993f49ef3736ff6325fb5345d9562ef173ae
Author: Sebb <se...@apache.org>
AuthorDate: Sun Jul 29 18:04:03 2018 +0100

    Better matching of multiple word names
---
 www/secretary/ldap-names.cgi | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/www/secretary/ldap-names.cgi b/www/secretary/ldap-names.cgi
index 4eb147b..9f89b66 100755
--- a/www/secretary/ldap-names.cgi
+++ b/www/secretary/ldap-names.cgi
@@ -114,10 +114,11 @@ _html do
       next if p.banned?
       given = p.givenName rescue '---' # some entries have not set this up
 
-      givenOK = p.cn.split.include? given
+      # Match the name as a word-bounded string
+      givenOK = (p.cn.match(/\b#{Regexp.quote(given)}\b/) != nil)
       badGiven += 1 unless givenOK
 
-      snOK = p.cn.split.include? p.sn
+      snOK =    (p.cn.match(/\b#{Regexp.quote(p.sn)}\b/) != nil)
       badSN += 1 unless snOK
 
       if givenOK and snOK # all checks OK