Skip to content

Commit

Permalink
Trim the image url before short url detection. Fixes #108.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrl committed Oct 11, 2016
1 parent 0892b1d commit af00908
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- The login session lifetime is now configurable (defaults to 24 hours), so you won't keep getting logged out all the time (in theory). (#113)
- Recent changes made on different days are now displayed separately, as they should be (#112)
- Always display footer message at the bottom of the page.
- Trim the image url before short image url detection (#108)

## v0.12.1

Expand Down
2 changes: 1 addition & 1 deletion build/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5333,7 +5333,7 @@ protected function inlineExtendedImage($fragment)
* 5 - Third param (optional)
*/
$altText = $matches[1];
$imageUrl = str_replace("&", "&", $matches[2]); // Decode & to allow it in preview urls
$imageUrl = trim(str_replace("&", "&", $matches[2])); // Decode & to allow it in preview urls
$param1 = empty($matches[3]) ? false : strtolower(trim($matches[3]));
$param2 = empty($matches[4]) ? false : strtolower(trim($matches[4]));
$param3 = empty($matches[5]) ? false : strtolower(trim($matches[5]));
Expand Down
2 changes: 1 addition & 1 deletion module_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
"author": "Emanuil Rusev & Starbeamrainbowlabs",
"description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation, and also *requires* write access to the disk on first load.",
"id": "parser-parsedown",
"lastupdate": 1472230366,
"lastupdate": 1476210216,
"optional": false
}
]
2 changes: 1 addition & 1 deletion modules/parser-parsedown.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ protected function inlineExtendedImage($fragment)
* 5 - Third param (optional)
*/
$altText = $matches[1];
$imageUrl = str_replace("&", "&", $matches[2]); // Decode & to allow it in preview urls
$imageUrl = trim(str_replace("&", "&", $matches[2])); // Decode & to allow it in preview urls
$param1 = empty($matches[3]) ? false : strtolower(trim($matches[3]));
$param2 = empty($matches[4]) ? false : strtolower(trim($matches[4]));
$param3 = empty($matches[5]) ? false : strtolower(trim($matches[5]));
Expand Down

0 comments on commit af00908

Please sign in to comment.