Priority: Urgent
Current State: Closed
Released In: n/a
Target Release:
Applies To: Extension
Component: Configure
Branches: master
There are some issues with REGEX setting types. I'll try to document the
{LoginNameFilterIn}
issues first.
1) Reset to default
Action |
Foswiki 1.2 |
Foswiki 1.1.9 |
Foswiki.spec |
qr/^[^\s\*?~^\$@%`"'&;&vbar;<>\x00-\x1f]+$/ |
qr/^[^\s\*?~^\$@%`"'&;&vbar;<>\x00-\x1f]+$/ |
First save |
qr/^[^\s\*?~^\$@%`"'&;&vbar;<>\x00-\x1f]+$/; |
|
Displayed |
^[^\s\*?~^\$@%`"'&;&vbar;<>\x00-\x1f]+$ |
|
Reset active |
qr/^[^\s\*?~^\$@%`"'&;&vbar;<>\x00-\x1f]+$/ |
|
Save |
'qr/^[^\s\*?~^\$@%`"'&;&vbar;<>\x00-\x1f]+$/' |
|
Saved as quoted qr/ string |
202c202
< $Foswiki::cfg{LoginNameFilterIn} = qr/^[^\s\*?~^\$@%`"'&;|<>\x00-\x1f]+$/;
---
> $Foswiki::cfg{LoginNameFilterIn} = 'qr/^[^\\s\\*?~^\\$@%`"\'&;|<>\\x00-\\x1f]+$/';
Following this save of the default, user registration is broken:
Incorrect LoginName
'JoeUser' is not a valid LoginName The JoeUser field must match the {LoginNameFilterIn} filter for this site
Action |
Foswiki 1.2 |
Foswiki.spec |
qr/[\s\*?~^\$@%`"'\x26;&vbar;\x3c>\[\]#\x00-\x1f]/ |
|
First save |
qr/[\s\*?~^\$@%`"'\x26;&vbar;\x3c>\[\]#\x00-\x1f]/ |
|
Displayed |
[\s\*?~^\$@%`"'\x26;&vbar;\x3c>\[\]#\x00-\x1f] |
|
Add a colon |
[\s\*?~^\$@%`"'\x26;:&vbar;\x3c>\[\]#\x00-\x1f] |
|
Save |
'[\\s\\*?~^\\$@%`"\'\\x26;:&vbar;\\x3c>\\[\\]#\\x00-\\x1f]' |
Saved as quoted string |
Reset to default |
Save |
'qr/[\\s\\*?~^\\$@%`"\'\\x26;&vbar;\\x3c>\\[\\]#\\x00-\\x1f]/' |
Saved as quoted qr string |
--
GeorgeClark - 24 Feb 2015
Hi Crawford, I have a fix for the regex issues... sort of.
Javascript now that uses the regex is failing. The
WebTopicCreator uses the
NameFilter as if a perl regex will work fine in javascript. No such luck.
I managed to get the
NameFilter working in javascript by crafting the following regex:
- It has to be a character string . Storing as qr/.../ fails.
- It can't have the (^:...) wrapper
- I had to tripple-escape the s, close sq. bracket, and the hex characters.
$Foswiki::cfg{NameFilter} = '[\\\s\*?~^$@%`\'"\\\x26;|\\\x3c>[\\\]#\\\x00-\\\x1f]';
I think we may need a utility function that converts a perl regex to javascript. Currently it's passed in
DefaultPreferences,
Set NAMEFILTER = %QUERY{NameFilter}%
which is then passed to the js env.
--
GeorgeClark - 26 Feb 2015
Just went back and checked 1.1.9. This is broken there as well, needs the \\\ triple escape for the js regexes to work in web topic creator.
--
GeorgeClark - 26 Feb 2015
Crawford, I've checked in a change to go back to quoted strings for regexes in
LocalSite.cfg, and
LoadSpec converts qr/ / style regexes in the Spec files back to quoted strings. So far tests fine. The "Reset to default" button is working correctly as well. And it comes really close to fixing the javascript NAMEFILTER issue,
Item13286, but there seems to be a deeper issue in jquery from what I can find that still corrupts the escapes.
--
GeorgeClark - 28 Feb 2015
your change was good, but I've extended it a bit.
--
CrawfordCurrie - 01 Mar 2015