diff options
author | Mario <mario@mariovavti.com> | 2020-10-01 08:26:03 +0200 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-10-01 08:26:03 +0200 |
commit | e4de9ef9034f8ce2c8d5f6693bf6a6ab50421fa7 (patch) | |
tree | 65f18d905f5fcd1c2d4174836567c4f534053c67 | |
parent | b878b6902817c7f442281cef30d346bd2a60659f (diff) | |
parent | e529635952c9a10f56d3bc90a666eccd9c5b9842 (diff) | |
download | volse-hubzilla-e4de9ef9034f8ce2c8d5f6693bf6a6ab50421fa7.tar.gz volse-hubzilla-e4de9ef9034f8ce2c8d5f6693bf6a6ab50421fa7.tar.bz2 volse-hubzilla-e4de9ef9034f8ce2c8d5f6693bf6a6ab50421fa7.zip |
Merge branch 'deletefixes' into 'dev'
delete fixes
See merge request hubzilla/core!1878
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 9 | ||||
-rw-r--r-- | include/network.php | 20 |
2 files changed, 27 insertions, 2 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index a6db9e431..9b4b05878 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -2116,6 +2116,11 @@ class Libzot { $item_found = false; $post_id = 0; + $m = parse_url($item['mid']); + unset($m['fragment']); + $normalised = unparse_url($m); + + // reactions such as like and dislike could have an mid with /activity/ in it. // Check for both forms in order to prevent duplicates. @@ -2124,8 +2129,8 @@ class Libzot { dbesc($sender), dbesc($sender), dbesc($sender), - dbesc($item['mid']), - dbesc(str_replace('/activity/', '/item/', $item['mid'])), + dbesc($normalised), + dbesc(str_replace('/activity/', '/item/', $normalised)), intval($uid) ); diff --git a/include/network.php b/include/network.php index d9d534cd7..750d56ac3 100644 --- a/include/network.php +++ b/include/network.php @@ -2061,3 +2061,23 @@ function get_request_string($url) { return '/' . ((count($a) > 3) ? $a[3] : EMPTY_STR); } + + +/* + * + * Takes the output of parse_url and builds a URL from it + * + */ + +function unparse_url($parsed_url) { + $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; + $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; + $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; + $user = isset($parsed_url['user']) ? $parsed_url['user'] : ''; + $pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : ''; + $pass = ($user || $pass) ? "$pass@" : ''; + $path = isset($parsed_url['path']) ? $parsed_url['path'] : ''; + $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; + $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; + return "$scheme$user$pass$host$port$path$query$fragment"; +} |