Skip to content

Commit

Permalink
Remove double URL encode when processing params in links - #860
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed May 30, 2016
1 parent 7fc2f20 commit 4de9c94
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Detect if user really meant to extend parent blueprint, not another one (fixes old page type blueprints)
* Fixed a bug in `Page::relativePagePath()` when `Page::$name` is not defined
* Fix for poor handling of params + query element in `Uri::processParams()` [#859](https://github.com/getgrav/grav/issues/859)
* Fix for double encoding in markdown links [#860](https://github.com/getgrav/grav/issues/860)

# v1.1.0-beta.5
## 05/23/2016
Expand Down
2 changes: 1 addition & 1 deletion system/src/Grav/Common/Markdown/ParsedownGravTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ protected function inlineLink($excerpt)
if (isset($url['query'])) {
$actions = array_reduce(explode('&', $url['query']), function ($carry, $item) {
$parts = explode('=', $item, 2);
$value = isset($parts[1]) ? $parts[1] : true;
$value = isset($parts[1]) ? rawurldecode($parts[1]) : true;
$carry[$parts[0]] = $value;

return $carry;
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/Grav/Common/Markdown/ParsedownTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ public function testExternalLinks()
$this->parsedown->text('[cnn.com](http://www.cnn.com)'));
$this->assertSame('<p><a href="https://www.google.com">google.com</a></p>',
$this->parsedown->text('[google.com](https://www.google.com)'));
$this->assertSame('<p><a href="https://github.com/getgrav/grav/issues/new?title=%5Badd-resource%5D%20New%20Plugin%2FTheme&body=Hello%20%2A%2AThere%2A%2A">complex url</a></p>',
$this->parsedown->text('[complex url](https://github.com/getgrav/grav/issues/new?title=[add-resource]%20New%20Plugin/Theme&body=Hello%20**There**)'));
}

public function testExternalLinksSubDir()
Expand Down

0 comments on commit 4de9c94

Please sign in to comment.