Skip to content

Commit 25b0e86

Browse files
committed
backup names don't actually matter all that much, they don't get used as file names
1 parent d27f0c6 commit 25b0e86

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function permission()
2121
public function rules(): array
2222
{
2323
return [
24-
'name' => 'nullable|string|max:255|regex:/^[w\][\w\s_.-]*[\w]$/',
24+
'name' => 'nullable|string|max:255',
2525
'ignore' => 'nullable|string',
2626
];
2727
}

app/Models/Backup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Backup extends Model
6565
public static $validationRules = [
6666
'server_id' => 'bail|required|numeric|exists:servers,id',
6767
'uuid' => 'required|uuid',
68-
'name' => 'required|string|regex:/^[w\][\w\s_.-]*[\w]$/',
68+
'name' => 'required|string',
6969
'ignored_files' => 'string',
7070
'disk' => 'required|string',
7171
'sha256_hash' => 'nullable|string',

app/Services/Backups/InitiateBackupService.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Ramsey\Uuid\Uuid;
66
use Carbon\CarbonImmutable;
7-
use Illuminate\Support\Str;
87
use Pterodactyl\Models\Backup;
98
use Pterodactyl\Models\Server;
109
use Pterodactyl\Repositories\Eloquent\BackupRepository;
@@ -59,7 +58,7 @@ public function handle(Server $server, string $name = null): Backup
5958
$backup = $this->repository->create([
6059
'server_id' => $server->id,
6160
'uuid' => Uuid::uuid4()->toString(),
62-
'name' => Str::lower(str_replace(' ', '_', trim($name))) ?: sprintf('backup_%s', CarbonImmutable::create()->format('YmdHis')),
61+
'name' => trim($name) ?: sprintf('Backup at %s', CarbonImmutable::create()->toDateTimeString()),
6362
'ignored_files' => $this->ignoredFiles ?? '',
6463
'disk' => 'local',
6564
], true, true);

resources/scripts/components/server/backups/CreateBackupButton.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ export default ({ onBackupGenerated }: Props) => {
9696
onSubmit={submit}
9797
initialValues={{ name: '', ignored: '' }}
9898
validationSchema={object().shape({
99-
name: string().required()
100-
.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.')
101-
.max(255),
99+
name: string().required().max(255),
102100
ignored: string(),
103101
})}
104102
>

0 commit comments

Comments
 (0)