aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2018-10-05 13:16:29 +0200
committerMax Kostikov <max@kostikov.co>2018-10-05 13:16:29 +0200
commitd9efb037e3d0c14fa288e8b54c3d55d67689ab54 (patch)
treeef9029b1f4d6808ab955b6c075161d2f35c590e6 /include/text.php
parent69659e9bd55f11e63fc93a8e6c5d5deea1489931 (diff)
downloadvolse-hubzilla-d9efb037e3d0c14fa288e8b54c3d55d67689ab54.tar.gz
volse-hubzilla-d9efb037e3d0c14fa288e8b54c3d55d67689ab54.tar.bz2
volse-hubzilla-d9efb037e3d0c14fa288e8b54c3d55d67689ab54.zip
Prevent links damage on foreign channel repost for cloned
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/text.php b/include/text.php
index f03d0b860..1d884593f 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2965,7 +2965,9 @@ function item_url_replace($channel,&$item,$old,$new,$oldnick = '') {
json_url_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['target']);
}
- if(string_replace($old,$new,$item['body'])) {
+ $x = preg_replace("/".preg_quote($old,'/')."\/(search|\w+\/".$channel['channel_address'].")/", $new.'/${1}', $item['body']);
+ if($x) {
+ $item['body'] = $x;
$item['sig'] = base64url_encode(rsa_sign($item['body'],$channel['channel_prvkey']));
$item['item_verified'] = 1;
}