mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-22 09:02:28 +01:00
api: fix docker_image
validation for local images (#5103)
This commit is contained in:
parent
37055fe5b4
commit
371c7a671d
@ -11,7 +11,7 @@ class EggFormRequest extends AdminFormRequest
|
|||||||
$rules = [
|
$rules = [
|
||||||
'name' => 'required|string|max:191',
|
'name' => 'required|string|max:191',
|
||||||
'description' => 'nullable|string',
|
'description' => 'nullable|string',
|
||||||
'docker_images' => ['required', 'string', 'regex:/^[\w#\.\/\- ]*\|*[\w\.\/\-:@ ]*$/im'],
|
'docker_images' => ['required', 'string', 'regex:/^[\w#\.\/\- ]*\|?~?[\w\.\/\-:@ ]*$/im'],
|
||||||
'force_outgoing_ip' => 'sometimes|boolean',
|
'force_outgoing_ip' => 'sometimes|boolean',
|
||||||
'file_denylist' => 'array',
|
'file_denylist' => 'array',
|
||||||
'startup' => 'required|string',
|
'startup' => 'required|string',
|
||||||
|
@ -24,7 +24,7 @@ class SetDockerImageRequest extends ClientApiRequest implements ClientPermission
|
|||||||
Assert::isInstanceOf($server, Server::class);
|
Assert::isInstanceOf($server, Server::class);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'docker_image' => ['required', 'string', 'max:191', 'regex:/^[\w#\.\/\- ]*\|*[\w\.\/\-:@ ]*$/', Rule::in(array_values($server->egg->docker_images))],
|
'docker_image' => ['required', 'string', 'max:191', 'regex:/^[\w#\.\/\- ]*\|?~?[\w\.\/\-:@ ]*$/', Rule::in(array_values($server->egg->docker_images))],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ class Egg extends Model
|
|||||||
'file_denylist' => 'array|nullable',
|
'file_denylist' => 'array|nullable',
|
||||||
'file_denylist.*' => 'string',
|
'file_denylist.*' => 'string',
|
||||||
'docker_images' => 'required|array|min:1',
|
'docker_images' => 'required|array|min:1',
|
||||||
'docker_images.*' => ['required', 'string', 'max:191', 'regex:/^[\w#\.\/\- ]*\|*[\w\.\/\-:@ ]*$/'],
|
'docker_images.*' => ['required', 'string', 'max:191', 'regex:/^[\w#\.\/\- ]*\|?~?[\w\.\/\-:@ ]*$/'],
|
||||||
'startup' => 'required|nullable|string',
|
'startup' => 'required|nullable|string',
|
||||||
'config_from' => 'sometimes|bail|nullable|numeric|exists:eggs,id',
|
'config_from' => 'sometimes|bail|nullable|numeric|exists:eggs,id',
|
||||||
'config_stop' => 'required_without:config_from|nullable|string|max:191',
|
'config_stop' => 'required_without:config_from|nullable|string|max:191',
|
||||||
|
@ -163,7 +163,7 @@ class Server extends Model
|
|||||||
'egg_id' => 'required|exists:eggs,id',
|
'egg_id' => 'required|exists:eggs,id',
|
||||||
'startup' => 'required|string',
|
'startup' => 'required|string',
|
||||||
'skip_scripts' => 'sometimes|boolean',
|
'skip_scripts' => 'sometimes|boolean',
|
||||||
'image' => ['required', 'string', 'max:191', 'regex:/^[\w\.\/\-:@ ]*$/'],
|
'image' => ['required', 'string', 'max:191', 'regex:/^~?[\w\.\/\-:@ ]*$/'],
|
||||||
'database_limit' => 'present|nullable|integer|min:0',
|
'database_limit' => 'present|nullable|integer|min:0',
|
||||||
'allocation_limit' => 'sometimes|nullable|integer|min:0',
|
'allocation_limit' => 'sometimes|nullable|integer|min:0',
|
||||||
'backup_limit' => 'present|nullable|integer|min:0',
|
'backup_limit' => 'present|nullable|integer|min:0',
|
||||||
|
Loading…
Reference in New Issue
Block a user