From 5d525a6aab900fcfbeef1d4eae60ec951a59c52e Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Thu, 29 Sep 2016 18:33:01 -0700 Subject: [PATCH] When finding links, remove the source URL from the list if present --- controllers/Controller.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/controllers/Controller.php b/controllers/Controller.php index 1a0a227..10475f3 100644 --- a/controllers/Controller.php +++ b/controllers/Controller.php @@ -282,6 +282,11 @@ class Controller { $links = array_values($client->findOutgoingLinks($parsed)); + // Remove the source URL from the list if present + $links = array_filter($links, function($link) use($sourceURL) { + return $link != $sourceURL; + }); + $response->headers->set('Content-Type', 'application/json'); $response->setContent(json_encode([ 'links' => $links