aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
authorM. Dent <dentm42@gmail.com>2019-03-08 02:48:03 +0100
committerM. Dent <dentm42@gmail.com>2019-03-08 02:48:03 +0100
commitc0b238b19a91650a633e350fdd91736b40e88223 (patch)
tree7fa419bdc925c5f2ab8eef65a5e28ea4ab3b01dc /Zotlabs/Lib
parent04fe7e61deb19b9b05c87bff037b7bbf1d7bc662 (diff)
parent1f7622e4c42bf71d1d38dd88c40c903d83a8d6c0 (diff)
downloadvolse-hubzilla-c0b238b19a91650a633e350fdd91736b40e88223.tar.gz
volse-hubzilla-c0b238b19a91650a633e350fdd91736b40e88223.tar.bz2
volse-hubzilla-c0b238b19a91650a633e350fdd91736b40e88223.zip
Merge branch 'dev' into 'dev'
fetch private objects using delivery channel credentials See merge request hubzilla/core!1545
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/Libzot.php33
1 files changed, 28 insertions, 5 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 4efd869f3..bc0826189 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1125,9 +1125,14 @@ class Libzot {
logger('Activity rejected: ' . print_r($data,true));
return;
}
- $arr = Activity::decode_note($AS);
+ if (is_array($AS->obj)) {
+ $arr = Activity::decode_note($AS);
+ }
+ else {
+ $arr = [];
+ }
- logger($AS->debug());
+ logger($AS->debug(),LOGGER_DATA);
}
@@ -1230,7 +1235,7 @@ class Libzot {
$relay = (($env['type'] === 'response') ? true : false );
- $result = self::process_delivery($env['sender'],$arr,$deliveries,$relay,false,$message_request);
+ $result = self::process_delivery($env['sender'],$AS,$arr,$deliveries,$relay,false,$message_request);
}
elseif($env['type'] === 'sync') {
// $arr = get_channelsync_elements($data);
@@ -1412,7 +1417,7 @@ class Libzot {
* @return array
*/
- static function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $request = false) {
+ static function process_delivery($sender, $act, $arr, $deliveries, $relay, $public = false, $request = false) {
$result = [];
@@ -1441,6 +1446,24 @@ class Libzot {
$DR->set_name($channel['channel_name'] . ' <' . channel_reddress($channel) . '>');
+ if(($act) && ($act->obj) && (! is_array($act->obj))) {
+ // The initial object fetch failed using the sys channel credentials.
+ // Try again using the delivery channel credentials.
+ // We will also need to re-parse the $item array,
+ // but preserve any values that were set during anonymous parsing.
+
+ $o = Activity::fetch($act->obj,$channel);
+ if($o) {
+ $act->obj = $o;
+ $arr = array_merge(Activity::decode_note($act),$arr);
+ }
+ else {
+ $DR->update('Incomplete or corrupt activity');
+ $result[] = $DR->get();
+ continue;
+ }
+ }
+
/**
* We need to block normal top-level message delivery from our clones, as the delivered
* message doesn't have ACL information in it as the cloned copy does. That copy
@@ -1859,7 +1882,7 @@ class Libzot {
logger('FOF Activity received: ' . print_r($arr,true), LOGGER_DATA, LOG_DEBUG);
logger('FOF Activity recipient: ' . $channel['channel_portable_id'], LOGGER_DATA, LOG_DEBUG);
- $result = self::process_delivery($arr['owner_xchan'],$arr, [ $channel['channel_portable_id'] ],false,false,true);
+ $result = self::process_delivery($arr['owner_xchan'],$AS, $arr, [ $channel['channel_portable_id'] ],false,false,true);
if ($result) {
$ret = array_merge($ret, $result);
}