mirror of
https://github.com/pelican-dev/panel.git
synced 2026-02-27 08:00:54 +03:00
Properly handle 404 for editing files (#816)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Repositories\Daemon;
|
||||
|
||||
use Carbon\CarbonInterval;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
use Illuminate\Http\Client\Response;
|
||||
use Webmozart\Assert\Assert;
|
||||
use App\Models\Server;
|
||||
@@ -21,6 +22,7 @@ class DaemonFileRepository extends DaemonRepository
|
||||
* @throws \GuzzleHttp\Exception\TransferException
|
||||
* @throws \App\Exceptions\Http\Server\FileSizeTooLargeException
|
||||
* @throws \App\Exceptions\Http\Connection\DaemonConnectionException
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public function getContent(string $path, ?int $notLargerThan = null): string
|
||||
{
|
||||
@@ -40,6 +42,10 @@ class DaemonFileRepository extends DaemonRepository
|
||||
throw new FileSizeTooLargeException();
|
||||
}
|
||||
|
||||
if ($response->getStatusCode() === 404) {
|
||||
throw new FileNotFoundException();
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user