]> git.mxchange.org Git - friendica.git/commitdiff
Correct self attribute in ATOM feeds
authorAlexandre Alapetite <alexandre@alapetite.fr>
Fri, 16 Nov 2018 17:54:06 +0000 (18:54 +0100)
committerAlexandre Alapetite <alexandre@alapetite.fr>
Fri, 16 Nov 2018 17:54:06 +0000 (18:54 +0100)
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

index d6562466445940b1a204a8cd251a0fb93be42e0b..5c9eed96a0195534c75d2d953f99b76fae26a103 100644 (file)
@@ -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);