[ 
https://issues.apache.org/jira/browse/JSPWIKI-853?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Juan Pablo Santos Rodríguez resolved JSPWIKI-853.
-------------------------------------------------
    Resolution: Cannot Reproduce

Unable to reproduce using following unit test with latest 2.11.0 snapshot:

{code}
@Test
public void testPageNameWithSpaces() throws Exception {
    engine.saveText( "Page With Spaces", "This is a test." );

    final MockHttpServletRequest request = engine.newHttpRequest( "/Wiki.jsp" );
    request.setMethod( "GET" );
    request.getParameterMap().put( "page", new String[]{ "Page With Spaces" } );

    final Context ctx = Wiki.context().create( engine, request, 
ContextEnum.PAGE_VIEW.getRequestContext() );
    final Page p = ctx.getPage();

    Assertions.assertEquals( "Page With Spaces", p.getName() );
}
{code}

Given that it's been a long time since the issue was opened, I'm closing it, as 
Cannot Reproduce. If you're still reproducing the issue, please reopen / 
comment on how are you using the JSPWiki at API level, so we can take another 
look at it.

> WikiEngine#createContext(Request, String) parses wrong page name
> ----------------------------------------------------------------
>
>                 Key: JSPWIKI-853
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-853
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.10.1
>            Reporter: Albrecht Striffler
>            Priority: Major
>
> We are using JSPWiki at an API level. Currently, we are transitioning from 
> using JSPWiki 2.8.2 to using 2.10.1 (the changed package names held us back 
> for a while). Since then, we have a problem with the method 
> createContext(HttpServletRequest request, String requestContext) 
> in the WikiEngine. While parsing the page name from the Request, the url 
> encoded page name is given to the util method MarkupParser.wikifyLink(String) 
> in the class CommandResolver line 302. There, non-word and non-digit 
> characters are removed. Since the page name is still encoded, it can contain 
> for example %20 for white spaces, which is then reduced to 20, which 
> obviously breaks stuff.
> Example: A page name like "My Page" will be become "My20Page".
> I think a fix should be very easy, just url-decode the string before cleaning 
> it. Somewhere in class CommandResolver line 440.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to