File tree Expand file tree Collapse file tree
main/java/com/ocpsoft/pretty/faces/url
test/java/com/ocpsoft/pretty/faces/url Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ Bugfixes:
2424* Performance: URLPatternParser got created on every call to UrlMapping.getPatternParser()
2525* Fixed incorrect handling of Spring AOP proxies during bean name lookup - thanks to mbenson for the patch #(119)
2626* Dynaview: Parameter injection now correctly happens before view determination (#120)
27-
27+ * Fixed decoding of quotation mark character. Thanks to Bruno Aranda for the patch. (#122)
2828
2929------------------------------------
3030 VERSION 3.3.0
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ private static String decodeSegment(final String segment)
143143 {
144144 try
145145 {
146- final URI uri = new URI (("http://localhost/" + segment ).replace (" " , "%20" ));
146+ final URI uri = new URI (("http://localhost/" + segment ).replace (" " , "%20" ). replace ( " \" " , "%22" ) );
147147 return uri .getPath ().substring (1 );
148148 }
149149 catch (URISyntaxException e )
Original file line number Diff line number Diff line change @@ -109,6 +109,10 @@ public void testSpaceEncodingAndDecoding() throws Exception
109109
110110 // decode
111111 assertEquals ("/a b" , new URL ("/a%20b" ).decode ().toURL ());
112+
113+ // decode of not-encoded character
114+ assertEquals ("/a b" , new URL ("/a b" ).decode ().toURL ());
115+
112116 }
113117
114118 @ Test
@@ -119,6 +123,22 @@ public void testQuestionMarkEncodingAndDecoding() throws Exception
119123
120124 // decode
121125 assertEquals ("/a?b" , new URL ("/a%3Fb" ).decode ().toURL ());
126+
127+ }
128+
129+ @ Test
130+ public void testQuoteCharacterEncodingAndDecoding () throws Exception
131+ {
132+
133+ // encode
134+ assertEquals ("/a%22b" , new URL ("/a\" b" ).encode ().toURL ());
135+
136+ // decode
137+ assertEquals ("/a\" b" , new URL ("/a%22b" ).decode ().toURL ());
138+
139+ // decode of not-encoded character
140+ assertEquals ("/a\" b" , new URL ("/a\" b" ).decode ().toURL ());
141+
122142 }
123143
124144}
You can’t perform that action at this time.
0 commit comments