Skip to content

Commit f5c2b0c

Browse files
committed
Fixed decoding of quotation mark character. Thanks to Bruno Aranda for the patch. (#122)
1 parent 26b4fe0 commit f5c2b0c

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎CHANGELOG.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

‎core/src/main/java/com/ocpsoft/pretty/faces/url/URL.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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)

‎core/src/test/java/com/ocpsoft/pretty/faces/url/URLTest.java‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)