Skip to content

Commit

Permalink
updated regression tests for fixes in sirthias#214
Browse files Browse the repository at this point in the history
fix bug introduced with fix sirthias#210, over-aggressive URL encoding.
  • Loading branch information
vsch committed Jan 3, 2016
1 parent 6e5d118 commit 165f274
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/java/org/pegdown/Attributes.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ void print(Printer printer) {
// url encode the query part
try {
String query = url.substring(pos + 1);
url = url.substring(0, pos + 1) + URLEncoder.encode(query, "UTF-8").replace("+","%20");
// reverse URL encoding of =, &
url = url.substring(0, pos + 1) + URLEncoder.encode(query, "UTF-8").replace("+","%20").replace("%3D", "=").replace("%26", "&");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/pegdown/AstText.ast
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ RootNode [0-942]
TextNode [281-286] 'multi'
SimpleNode [286-287] Linebreak
TextNode [287-298] ' paragraph'
ParaNode [302-314]
ParaNode [304-314]
SuperNode [304-314]
TextNode [304-313] 'list item'
SpecialTextNode [313-314] '!'
Expand Down
5 changes: 4 additions & 1 deletion src/test/resources/pegdown/Autolinks.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ <h1><a href="#autolinks" name="autolinks">Autolinks</a></h1>
and URI links (<a href="mailto:[email protected]">[email protected]</a>
is such an example).<br/>
<a href="ftp://somesite.org:1234">ftp://somesite.org:1234</a>: this would be another one!</p>
<p>or emphasis and strikethrough markers<br>
URI links <strong><a href="mailto:[email protected]">[email protected]</a></strong> is such an example.<br>
<strong><a href="ftp://somesite.org:1234">ftp://somesite.org:1234</a></strong> this would be another one!</p>
<p>The following links should work just normally:</p>
<ul>
<li><a href="http://example">example</a></li>
<li><a href="http://example">ex@mple</a></li>
<li><a href="http://example">example://</a></li>
</ul>
</ul>

0 comments on commit 165f274

Please sign in to comment.