summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Engster <deng@randomsample.de>2020-05-18 22:00:41 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2020-05-21 12:02:25 +0200
commit864794461ff14b8a049677c0e4607e3c606c5fca (patch)
tree5e984ee8196fb376edc846002d3c6b616189ef6b
parent1345578a3146c515db6533cd251e9f0c597fcd12 (diff)
Do not create spurious links in item body
The 'str_replace' will match any HTML element that starts with '<a', including things like '<address' or '<article', thus creating spurious links in item bodies. Fix that by simply adding one whitespace. Fixes issue #527. Signed-off-by: David Engster <deng@randomsample.de>
-rw-r--r--lib/Db/Item.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Db/Item.php b/lib/Db/Item.php
index e88635435..3dedd308d 100644
--- a/lib/Db/Item.php
+++ b/lib/Db/Item.php
@@ -291,7 +291,7 @@ class Item extends Entity implements IAPI, \JsonSerializable
{
// FIXME: this should not happen if the target="_blank" is already
// on the link
- $body = str_replace('<a', '<a target="_blank" rel="noreferrer"', $body);
+ $body = str_replace('<a ', '<a target="_blank" rel="noreferrer" ', $body);
if ($this->body !== $body) {
$this->body = $body;