Support using pipe characters within egg validation rules; closes #1960

This commit is contained in:
Dane Everitt 2020-05-07 20:40:19 -07:00
parent 69eb33fb89
commit 49dee28eb8
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -2,6 +2,7 @@
namespace Pterodactyl\Services\Eggs\Variables;
use Illuminate\Support\Str;
use Pterodactyl\Models\EggVariable;
use Illuminate\Contracts\Validation\Factory;
use Pterodactyl\Exceptions\DisplayException;
@ -81,7 +82,11 @@ class VariableUpdateService
}
if (! empty($data['rules'] ?? '')) {
$this->validateRules($data['rules']);
$this->validateRules(
(is_string($data['rules']) && Str::contains($data['rules'], ';;'))
? explode(';;', $data['rules'])
: $data['rules']
);
}
$options = array_get($data, 'options') ?? [];