summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-09-14 16:20:50 +0200
committerRobin Appelman <robin@icewind.nl>2020-09-18 19:27:44 +0200
commitce1484f1b04bfea7e4df9ff700d86f413209a287 (patch)
tree492d975fb2bedc265c566c705545503be170e5f1 /lib
parentab2379013a9cbe25bb2860b95c00e3398ba088d3 (diff)
preserve some of the whitespace from html tags
without the "html whitespace" a hashtag posted after a url will be seen as part of the link by linkify, and then mangled by the hashtagmangler and break the url. additionally this keeps the appearance of the post closer to the original Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/Model/ActivityPub/ACore.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Model/ActivityPub/ACore.php b/lib/Model/ActivityPub/ACore.php
index c57d458e..ead56251 100644
--- a/lib/Model/ActivityPub/ACore.php
+++ b/lib/Model/ActivityPub/ACore.php
@@ -557,10 +557,14 @@ class ACore extends Item implements JsonSerializable {
return $value;
case self::AS_STRING:
+ // try to preserve some whitespace from the html tags
+ $value = preg_replace("/\<br *\/?\>/", "\n", $value);
+ $value = preg_replace("/\<\/?p>/", "\n", $value);
+
$value = strip_tags($value);
$value = html_entity_decode($value, ENT_QUOTES | ENT_HTML5);
- return $value;
+ return trim($value);
case self::AS_USERNAME:
$value = strip_tags($value);