mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
32 lines
879 B
PHP
32 lines
879 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Http\Requests\Api\Admin\Extensions;
|
|
|
|
use Illuminate\Http\UploadedFile;
|
|
use Pterodactyl\Services\Extensions\ExtensionSettingFiles;
|
|
use UnexpectedValueException;
|
|
|
|
class UploadExtensionSettingFileRequest extends UpdateExtensionRequest
|
|
{
|
|
/**
|
|
* The setting's own size limit and type allow-list are enforced against the
|
|
* file's content when it is stored; this is only the outer bound.
|
|
*
|
|
* @return ValidationRules
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return ['file' => ['required', 'file', 'max:'.ExtensionSettingFiles::MAX_KILOBYTES]];
|
|
}
|
|
|
|
public function upload(): UploadedFile
|
|
{
|
|
$file = $this->file('file');
|
|
throw_unless($file instanceof UploadedFile, UnexpectedValueException::class, 'Expected an uploaded settings file.');
|
|
|
|
return $file;
|
|
}
|
|
}
|