From 2d0a253e071280c692b14516a6aac8d6c33c44d5 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 1 Jun 2021 21:18:02 -0600 Subject: [PATCH] Update DirectMessageController, disable exception logging for invalid urls. Fixes #2752 --- app/Exceptions/Handler.php | 4 +++- app/Http/Controllers/DirectMessageController.php | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index a2aa11f9..d72030a6 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -5,6 +5,7 @@ namespace App\Exceptions; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Throwable; use League\OAuth2\Server\Exception\OAuthServerException; +use Zttp\ConnectionException; class Handler extends ExceptionHandler { @@ -14,7 +15,8 @@ class Handler extends ExceptionHandler * @var array */ protected $dontReport = [ - OAuthServerException::class + OAuthServerException::class, + ConnectionException::class ]; /** diff --git a/app/Http/Controllers/DirectMessageController.php b/app/Http/Controllers/DirectMessageController.php index e01a0ef9..21bb2674 100644 --- a/app/Http/Controllers/DirectMessageController.php +++ b/app/Http/Controllers/DirectMessageController.php @@ -596,6 +596,10 @@ class DirectMessageController extends Controller $q = $request->input('q'); $r = $request->input('remote'); + if(!Str::of($q)->contains('.')) { + return []; + } + if($r && Helpers::validateUrl($q)) { Helpers::profileFetch($q); }