From 53f4f2227d6b1bf6886dac35d7a7fb58d2131ece Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Tue, 11 Oct 2016 19:26:42 +0100 Subject: [PATCH] Trim the image url before short url detection. Fixes #108. --- Changelog.md | 1 + build/index.php | 2 +- module_index.json | 2 +- modules/parser-parsedown.php | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index dc3f458..ed634e6 100755 --- a/Changelog.md +++ b/Changelog.md @@ -15,6 +15,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) - Fxed huge issue with `contentonly` display mode. ## v0.12.1 diff --git a/build/index.php b/build/index.php index 764a2f9..5ac5096 100755 --- a/build/index.php +++ b/build/index.php @@ -5345,7 +5345,7 @@ class PeppermintParsedown extends ParsedownExtra * 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])); diff --git a/module_index.json b/module_index.json index 44d8ab1..a7a1578 100755 --- a/module_index.json +++ b/module_index.json @@ -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": 1476813024, + "lastupdate": 1476814064, "optional": false } ] \ No newline at end of file diff --git a/modules/parser-parsedown.php b/modules/parser-parsedown.php index 43d2c8d..13e064e 100644 --- a/modules/parser-parsedown.php +++ b/modules/parser-parsedown.php @@ -405,7 +405,7 @@ class PeppermintParsedown extends ParsedownExtra * 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]));