From 97d164f69eaf4ec057d5e93e4fbcb73334718259 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 16 Nov 2018 18:54:06 +0100 Subject: [PATCH] Correct self attribute in ATOM feeds Fix for https://github.com/friendica/friendica/issues/6128#issuecomment-439016471 Special case for DFRN to reduce the risk of unintended side effects --- src/Protocol/OStatus.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index d656246644..5c9eed96a0 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -1320,7 +1320,13 @@ class OStatus $attributes = ["href" => System::baseUrl() . "/salmon/" . $owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-mention"]; XML::addElement($doc, $root, "link", "", $attributes); - $attributes = ["href" => System::baseUrl() . "/dfrn_poll/" . $owner["nick"], + if (empty($_SERVER['REQUEST_URI']) || strpos($_SERVER['REQUEST_URI'], '/dfrn_poll/') !== false) { + $selfUri = "/dfrn_poll/" . $owner["nick"]; + } else { + $selfUri = $_SERVER['REQUEST_URI']; + } + + $attributes = ["href" => System::baseUrl() . $selfUri, "rel" => "self", "type" => "application/atom+xml"]; XML::addElement($doc, $root, "link", "", $attributes); -- 2.39.5