If folder does not exist, reload the file manager index

This commit is contained in:
Dane Everitt 2017-12-31 10:30:19 -06:00
parent 8ce0863559
commit 6b2d7b6488
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
4 changed files with 28 additions and 3 deletions

View File

@ -7,18 +7,38 @@ use Pterodactyl\Exceptions\DisplayException;
class DaemonConnectionException extends DisplayException
{
/**
* @var int
*/
private $statusCode = 500;
/**
* Throw a displayable exception caused by a daemon connection error.
*
* @param \GuzzleHttp\Exception\GuzzleException $previous
* @param bool $useStatusCode
*/
public function __construct(GuzzleException $previous)
public function __construct(GuzzleException $previous, bool $useStatusCode = false)
{
/** @var \GuzzleHttp\Psr7\Response|null $response */
$response = method_exists($previous, 'getResponse') ? $previous->getResponse() : null;
if ($useStatusCode) {
$this->statusCode = is_null($response) ? 500 : $response->getStatusCode();
}
parent::__construct(trans('admin/server.exceptions.daemon_exception', [
'code' => is_null($response) ? 'E_CONN_REFUSED' : $response->getStatusCode(),
]), $previous, DisplayException::LEVEL_WARNING);
}
/**
* Return the HTTP status code for this exception.
*
* @return int
*/
public function getStatusCode()
{
return $this->statusCode;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -63,6 +63,11 @@ class FileManager {
if (_.isFunction(next)) {
return next(new Error('Failed to load file listing.'));
}
if ((path !== '' && path !== '/') && jqXHR.status === 404) {
return this.list('', next);
}
swal({
type: 'error',
title: 'File Error',