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?

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


--
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
[EMAIL PROTECTED]                     [EMAIL PROTECTED]

Reply via email to