use Friendica\Network\Probe;
use Friendica\Util\Profiler;
use Friendica\Util\Strings;
+use GuzzleHttp\Psr7\Uri;
use Psr\Log\LoggerInterface;
class Follow extends BaseModule
$this->page['aside'] = VCard::getHTML($contact);
$output .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'),
- ['$title' => $this->t('Status Messages and Posts')]
+ ['$title' => $this->t('Posts and Replies')]
);
// Show last public posts
protected function followRemoteItem(string $url)
{
- $itemId = Item::fetchByLink($url, $this->session->getLocalUserId());
- if (!$itemId) {
- // If the user-specific search failed, we search and probe a public post
- $itemId = Item::fetchByLink($url);
- }
+ try {
+ $uri = new Uri($url);
+ if (!$uri->getScheme()) {
+ return;
+ }
+
+ $itemId = Item::fetchByLink($url, $this->session->getLocalUserId());
+ if (!$itemId) {
+ // If the user-specific search failed, we search and probe a public post
+ $itemId = Item::fetchByLink($url);
+ }
- if (!empty($itemId)) {
- $item = Post::selectFirst(['guid'], ['id' => $itemId]);
- if (!empty($item['guid'])) {
- $this->baseUrl->redirect('display/' . $item['guid']);
+ if (!empty($itemId)) {
+ $item = Post::selectFirst(['guid'], ['id' => $itemId]);
+ if (!empty($item['guid'])) {
+ $this->baseUrl->redirect('display/' . $item['guid']);
+ }
}
+ } catch (\InvalidArgumentException $e) {
+ return;
}
}
}