Merge pull request #11757 from annando/diaspora

Fix  processing of incoming Diaspora messages
This commit is contained in:
Hypolite Petovan 2022-07-20 07:54:46 -04:00 committed by GitHub
commit 561230d1ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -705,7 +705,7 @@ class Diaspora
// This is something that shouldn't happen at all. // This is something that shouldn't happen at all.
if (in_array($type, ['status_message', 'reshare', 'profile'])) { if (in_array($type, ['status_message', 'reshare', 'profile'])) {
if ($msg['author'] != $fields->author) { if ($msg['author'] != $fields->author) {
Logger::notice('Message handle is not the same as envelope sender. Quitting this message.'); Logger::notice('Message handle is not the same as envelope sender. Quitting this message.', ['author1' => $msg['author'], 'author2' => $fields->author]);
return false; return false;
} }
} }
@ -760,7 +760,7 @@ class Diaspora
{ {
$handle = strval($handle); $handle = strval($handle);
Logger::notice('Fetching diaspora key for: ' . $handle); Logger::notice('Fetching diaspora key', ['handle' => $handle, 'callstack' => System::callstack(20)]);
$fcontact = FContact::getByURL($handle); $fcontact = FContact::getByURL($handle);
if (!empty($fcontact['pubkey'])) { if (!empty($fcontact['pubkey'])) {

View file

@ -141,9 +141,9 @@ class XML
* @param string $elementname Name of the XML element of the target * @param string $elementname Name of the XML element of the target
* @return void * @return void
*/ */
public static function copy(&$source, &$target, string $elementname) public static function copy(&$source, &$target, $elementname)
{ {
if (is_string($source)) { if (count($source->children()) == 0) {
$target->addChild($elementname, self::escape($source)); $target->addChild($elementname, self::escape($source));
} else { } else {
$child = $target->addChild($elementname); $child = $target->addChild($elementname);