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 @@ -13,6 +13,7 @@ Bugfixes:
1313* Empty segments are now handled correctly - thanks to Piotr Jastrzebski for the patch (#123)
1414* Fixed encoding for square brackets and less/greater than characters
1515* Don't apply rewrite rule to requests forwarded by URL-mappings anymore
16+ * Fixed encoding/decoding of vertical bar (|) character
1617
1718------------------------------------
1819 VERSION 3.3.2
Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ private static String decodeSegment(final String segment)
152152 .replace ("]" , "%5D" )
153153 .replace ("<" , "%3C" )
154154 .replace (">" , "%3E" )
155+ .replace ("|" , "%7C" )
155156 );
156157 return uri .getPath ().substring (1 );
157158 }
Original file line number Diff line number Diff line change @@ -188,5 +188,21 @@ public void testLessGreaterThanEncodingAndDecoding() throws Exception
188188 assertEquals ("/<a>" , new URL ("/<a>" ).decode ().toURL ());
189189
190190 }
191-
191+
192+ @ Test
193+ public void testPipeEncodingAndDecoding () throws Exception
194+ {
195+
196+ // encode
197+ assertEquals ("/%7C" , new URL ("/|" ).encode ().toURL ());
198+
199+ // decode
200+ assertEquals ("/|" , new URL ("/%7C" ).decode ().toURL ());
201+
202+ // decode of not-encoded character
203+ assertEquals ("/|" , new URL ("/|" ).decode ().toURL ());
204+
205+ }
206+
207+
192208}
You can’t perform that action at this time.
0 commit comments