You are here: Foswiki>Tasks Web>Item14415 (31 Jan 2018, GeorgeClark)Edit Attach

Item14415: TopicUserMapping places non-ASCII users in wrong position in WikiUsersTopic.

pencil
Priority: Normal
Current State: Closed
Released In: 2.1.5
Target Release: patch
Applies To: Extension
Component: I18N, TopicUserMappingContrib
Branches: Item14414 Release02x01 master Item14288 Item14380 Item14537
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
It doesn't use NFKD normalization when searching for the point to insert the name. For example, with some tests registrations:

Also, the FAQRebuildingWikiUsersTopic skips users with non-A-Z first character.

Probably best to just drop the A-Z index, at least when rebuilding the topic using the FAQ. It's a convenience, not operational.

-- GeorgeClark - 07 Jun 2017

Somewhat related, a non-wikiword user will break the list. All inserts occur ahead of the non-wikiword. Should not happen, but it could, for ex after a topic rename.

-- GeorgeClark - 30 Sep 2017

I think that the following would fix the case of a username not being a wikiword.
diff --git a/TopicUserMappingContrib/lib/Foswiki/Users/TopicUserMapping.pm b/TopicUserMappingContrib/lib/Foswiki/Users/TopicUserMapping.pm
index 576cd84..8b7f6f2 100755
--- a/TopicUserMappingContrib/lib/Foswiki/Users/TopicUserMapping.pm
+++ b/TopicUserMappingContrib/lib/Foswiki/Users/TopicUserMapping.pm
@@ -398,7 +398,7 @@ sub _maintainUsersTopic {
         if ($entry) {
             my ( $web, $name, $odate ) = ( '', '', '' );
             if ( $line =~
-m/^\s+\*\s($Foswiki::regex{webNameRegex}\.)?($Foswiki::regex{wikiWordRegex})\s*(?:-\s*\w+\s*)?-\s*(.*)/
+m/^\s+\*\s($Foswiki::regex{webNameRegex}\.)?($Foswiki::regex{webNameBaseRegex})\s*(?:-\s*\w+\s*)?-\s*(.*)/
               )
             {
                 $web   = $1 || $Foswiki::cfg{UsersWebName};

Though this code is still rather fragile. If a user is renamed, it would cause the list to be out of order, and insertions would end up in the wrong place. Rather than a line-by-line search and positional insert, it might be better to read the whole list in, add the new entry, and then sort & write it back out. This would also correct out-of-place entries caused by user rename.

-- GeorgeClark - 14 Oct 2017

Keeping this fix in 2.1.5. Defer any more forgiving regex work for 2.2

-- GeorgeClark - 16 Oct 2017
 
Topic revision: r12 - 31 Jan 2018, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy