Fix empty server descriptions throwing SQL errors, closes #842
This commit is contained in:
parent
4457634127
commit
958c29cfbf
|
@ -76,7 +76,7 @@ class Server extends Model implements CleansAttributes, ValidableContract
|
||||||
'owner_id' => 'exists:users,id',
|
'owner_id' => 'exists:users,id',
|
||||||
'name' => 'regex:/^([\w .-]{1,200})$/',
|
'name' => 'regex:/^([\w .-]{1,200})$/',
|
||||||
'node_id' => 'exists:nodes,id',
|
'node_id' => 'exists:nodes,id',
|
||||||
'description' => 'nullable|string',
|
'description' => 'string',
|
||||||
'memory' => 'numeric|min:0',
|
'memory' => 'numeric|min:0',
|
||||||
'swap' => 'numeric|min:-1',
|
'swap' => 'numeric|min:-1',
|
||||||
'io' => 'numeric|between:10,1000',
|
'io' => 'numeric|between:10,1000',
|
||||||
|
|
|
@ -95,9 +95,9 @@ class DetailsModificationService
|
||||||
|
|
||||||
$this->connection->beginTransaction();
|
$this->connection->beginTransaction();
|
||||||
$this->repository->withoutFresh()->update($server->id, [
|
$this->repository->withoutFresh()->update($server->id, [
|
||||||
'owner_id' => array_get($data, 'owner_id') ?? $server->owner_id,
|
'owner_id' => array_get($data, 'owner_id'),
|
||||||
'name' => array_get($data, 'name') ?? $server->name,
|
'name' => array_get($data, 'name'),
|
||||||
'description' => array_get($data, 'description') ?? $server->description,
|
'description' => array_get($data, 'description', ''),
|
||||||
], true, true);
|
], true, true);
|
||||||
|
|
||||||
if (array_get($data, 'owner_id') != $server->owner_id) {
|
if (array_get($data, 'owner_id') != $server->owner_id) {
|
||||||
|
|
|
@ -106,6 +106,7 @@ class ServerCreationService
|
||||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
*/
|
*/
|
||||||
public function create(array $data)
|
public function create(array $data)
|
||||||
{
|
{
|
||||||
|
@ -117,7 +118,7 @@ class ServerCreationService
|
||||||
'uuidShort' => str_random(8),
|
'uuidShort' => str_random(8),
|
||||||
'node_id' => array_get($data, 'node_id'),
|
'node_id' => array_get($data, 'node_id'),
|
||||||
'name' => array_get($data, 'name'),
|
'name' => array_get($data, 'name'),
|
||||||
'description' => array_get($data, 'description'),
|
'description' => array_get($data, 'description', ''),
|
||||||
'skip_scripts' => isset($data['skip_scripts']),
|
'skip_scripts' => isset($data['skip_scripts']),
|
||||||
'suspended' => false,
|
'suspended' => false,
|
||||||
'owner_id' => array_get($data, 'owner_id'),
|
'owner_id' => array_get($data, 'owner_id'),
|
||||||
|
|
Loading…
Reference in New Issue