[weld-issues] [JBoss JIRA] (WELD-954) URIs escaped twice in URLScanner

Ales Justin (Commented) (JIRA) jira-events at lists.jboss.org
Fri Oct 28 08:50:46 EDT 2011


    [ https://issues.jboss.org/browse/WELD-954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638276#comment-12638276 ] 

Ales Justin commented on WELD-954:
----------------------------------

I've added this simple single-escape code:

        StringBuilder builder = new StringBuilder();
        int length = urlPath.length();
        for (int i = 0; i < length; i++) {
            boolean done = false;
            char ch = urlPath.charAt(i);
            if (ch == '%') {
                if (i + 2 < length) {
                    // ok, it's not %2x
                    if (urlPath.charAt(i + 1) != '2') {
                        builder.append("%25");
                        done = true;
                    } else {
                        char ch2 = urlPath.charAt(i + 2);
                        // it's not %20 or %25
                        if (ch2 != '0' && ch2 != '5') {
                            builder.append("%25");
                            done = true;
                        }
                    }
                }
            } else if (ch == ' ') {
                builder.append("%20");
                done = true;
            }

            if (done == false)
                builder.append(ch);
        }
        return builder.toString();

I guess this should be OK for now?
                
> URIs escaped twice in URLScanner
> --------------------------------
>
>                 Key: WELD-954
>                 URL: https://issues.jboss.org/browse/WELD-954
>             Project: Weld
>          Issue Type: Bug
>          Components: Bootstrap and Metamodel API
>    Affects Versions: 1.1.2.Final
>            Reporter: Emond Papegaaij
>            Assignee: Ales Justin
>
> The fix for WELD-834 can cause spaces to be escaped twice in an URL. This leads to errors like: Error handling file /var/lib/jenkins/jobs/Wicket%2520Weld/workspace/wicket-cdi-examples/target/classes
> Notice how 'Wicket%20Weld' is escaped to 'Wicket%2520Weld'. https://github.com/papegaaij/wicket-cdi demonstrates the problem, clone the project in a directory with a space in the name, and run 'mvn install -Dwicket.version=1.5-RC5.1'.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list