Andreas Hartmann wrote:
> Carsten Ziegeler wrote:
>> Hi,
>>
>> I just fixed the bug in our wildcard helper. The problem was the
>> following: if a pattern ends with a constant string (like ".xml")
>> and the uri in question contained this constant twice (like
>> ("hello.xml.xml") the pattern did not match.
>
>
> We noticed a problem in Lenya:
>
> <map:match pattern="*/">
> <map:redirect-to uri="introduction.html"/>
> </map:match>
>
> After the change, this matches all URLs ending with a slash,
> even ones containing slashes. This is not intended, is it?
>
No, it's definitly not. This is a bug, I'll add your test case.
Carsten
> I added a method to the WildcardHelperTestCase:
>
> public void testEndPattern() throws Exception {
> final Map resultMap = new HashMap();
> final String pattern = "*/";
> final int[] expr = WildcardHelper.compilePattern(pattern);
> boolean result = WildcardHelper.match(resultMap, "foo/bar/", expr);
> assertFalse("Url 'foo/bar/' should not match pattern '*/'.", result);
>
> result = WildcardHelper.match(resultMap, "foo/", expr);
> assertTrue("Url 'foo/' should match pattern '*/'", result);
> }
>
> resulting in:
>
> Testcase: testEndPattern took 0,003 sec FAILED
> Url 'foo/bar/' should not match pattern '*/'.
>
>
>
>
> Is this a bug, or do I misinterpret the matching functionality?
>
> Thanks!
>
> -- Andreas
>
>
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/