]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Diaspora/Fetch.php
Add new module and widget for managing saved searches
[friendica.git] / src / Module / Diaspora / Fetch.php
index e6f94a958e4dd5238ee98cb7078cd12b116b6399..467d64566b769048d1f5a106866afcfa7c49754d 100644 (file)
@@ -4,6 +4,7 @@ namespace Friendica\Module\Diaspora;
 
 use Friendica\BaseModule;
 use Friendica\Core\Protocol;
+use Friendica\Core\System;
 use Friendica\Model\Item;
 use Friendica\Model\User;
 use Friendica\Network\HTTPException;
@@ -40,14 +41,14 @@ class Fetch extends BaseModule
                        $item = Item::selectFirst(['author-link'], $condition);
                        if (empty($item)) {
                                $parts = parse_url($item["author-link"]);
+                               if (empty($parts["scheme"]) || empty($parts["host"])) {
+                                       throw new HTTPException\InternalServerErrorException();
+                               }
                                $host = $parts["scheme"] . "://" . $parts["host"];
 
                                if (Strings::normaliseLink($host) != Strings::normaliseLink($app->getBaseURL())) {
                                        $location = $host . "/fetch/" . $app->argv[1] . "/" . urlencode($guid);
-
-                                       header("HTTP/1.1 301 Moved Permanently");
-                                       header("Location:" . $location);
-                                       exit();
+                                       System::externalRedirect($location, 301);
                                }
                        }