backup names don't actually matter all that much, they don't get used as file names
This commit is contained in:
parent
d27f0c6f2a
commit
25b0e86730
4 changed files with 4 additions and 7 deletions
|
@ -21,7 +21,7 @@ class StoreBackupRequest extends ClientApiRequest
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => 'nullable|string|max:255|regex:/^[w\][\w\s_.-]*[\w]$/',
|
'name' => 'nullable|string|max:255',
|
||||||
'ignore' => 'nullable|string',
|
'ignore' => 'nullable|string',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ class Backup extends Model
|
||||||
public static $validationRules = [
|
public static $validationRules = [
|
||||||
'server_id' => 'bail|required|numeric|exists:servers,id',
|
'server_id' => 'bail|required|numeric|exists:servers,id',
|
||||||
'uuid' => 'required|uuid',
|
'uuid' => 'required|uuid',
|
||||||
'name' => 'required|string|regex:/^[w\][\w\s_.-]*[\w]$/',
|
'name' => 'required|string',
|
||||||
'ignored_files' => 'string',
|
'ignored_files' => 'string',
|
||||||
'disk' => 'required|string',
|
'disk' => 'required|string',
|
||||||
'sha256_hash' => 'nullable|string',
|
'sha256_hash' => 'nullable|string',
|
||||||
|
|
|
@ -4,7 +4,6 @@ namespace Pterodactyl\Services\Backups;
|
||||||
|
|
||||||
use Ramsey\Uuid\Uuid;
|
use Ramsey\Uuid\Uuid;
|
||||||
use Carbon\CarbonImmutable;
|
use Carbon\CarbonImmutable;
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Pterodactyl\Models\Backup;
|
use Pterodactyl\Models\Backup;
|
||||||
use Pterodactyl\Models\Server;
|
use Pterodactyl\Models\Server;
|
||||||
use Pterodactyl\Repositories\Eloquent\BackupRepository;
|
use Pterodactyl\Repositories\Eloquent\BackupRepository;
|
||||||
|
@ -59,7 +58,7 @@ class InitiateBackupService
|
||||||
$backup = $this->repository->create([
|
$backup = $this->repository->create([
|
||||||
'server_id' => $server->id,
|
'server_id' => $server->id,
|
||||||
'uuid' => Uuid::uuid4()->toString(),
|
'uuid' => Uuid::uuid4()->toString(),
|
||||||
'name' => Str::lower(str_replace(' ', '_', trim($name))) ?: sprintf('backup_%s', CarbonImmutable::create()->format('YmdHis')),
|
'name' => trim($name) ?: sprintf('Backup at %s', CarbonImmutable::create()->toDateTimeString()),
|
||||||
'ignored_files' => $this->ignoredFiles ?? '',
|
'ignored_files' => $this->ignoredFiles ?? '',
|
||||||
'disk' => 'local',
|
'disk' => 'local',
|
||||||
], true, true);
|
], true, true);
|
||||||
|
|
|
@ -96,9 +96,7 @@ export default ({ onBackupGenerated }: Props) => {
|
||||||
onSubmit={submit}
|
onSubmit={submit}
|
||||||
initialValues={{ name: '', ignored: '' }}
|
initialValues={{ name: '', ignored: '' }}
|
||||||
validationSchema={object().shape({
|
validationSchema={object().shape({
|
||||||
name: string().required()
|
name: string().required().max(255),
|
||||||
.matches(/^[w\][\w\s_.-]*[\w]$/, 'Backup name must only contain alpha-numeric characters, spaces, underscores, dashes, and periods. The name must start and end with an alpha-numeric character.')
|
|
||||||
.max(255),
|
|
||||||
ignored: string(),
|
ignored: string(),
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in a new issue