Relax upload type checks for .zst backups

This commit is contained in:
2026-02-11 01:54:30 +02:00
parent 1e66f43d4e
commit a566a2ae64
4 changed files with 7 additions and 23 deletions

View File

@@ -478,7 +478,7 @@ class ImportProcessCommand extends Command
{
$archivePath = strtolower($archivePath);
if (str_ends_with($archivePath, '.tar.zst')) {
if (str_ends_with($archivePath, '.tar.zst') || str_ends_with($archivePath, '.zst')) {
return 'tar --zstd -xf';
}

View File

@@ -192,14 +192,6 @@ class DirectAdminMigration extends Page implements HasActions, HasForms
->disk('backups')
->directory('directadmin-migrations')
->preserveFilenames()
->acceptedFileTypes([
'application/gzip',
'application/x-gzip',
'application/zstd',
'application/x-zstd',
'application/x-tar',
'application/octet-stream',
])
->visible(fn (Get $get): bool => $get('importMethod') === 'backup_file'),
TextInput::make('backupFilePath')
->label(__('Backup File Path'))

View File

@@ -230,14 +230,6 @@ class DirectAdminMigration extends Page implements HasActions, HasForms
->label(__('DirectAdmin Backup Archive'))
->storeFiles(false)
->required()
->acceptedFileTypes([
'application/octet-stream',
'application/x-tar',
'application/zstd',
'application/x-zstd',
'application/gzip',
'application/x-gzip',
])
->maxSize(512000) // 500MB in KB
->helperText(__('Supported formats: .tar.zst, .tar.gz, .tgz (max 500MB via upload)')),
])
@@ -256,8 +248,8 @@ class DirectAdminMigration extends Page implements HasActions, HasForms
$filename = (string) $file->getClientOriginalName();
$filename = basename($filename);
if (! preg_match('/\\.(tar\\.zst|tar\\.gz|tgz)$/i', $filename)) {
throw new Exception(__('Backup must be a .tar.zst, .tar.gz or .tgz file.'));
if (! preg_match('/\\.(tar\\.zst|zst|tar\\.gz|tgz)$/i', $filename)) {
throw new Exception(__('Backup must be a .zst, .tar.zst, .tar.gz or .tgz file.'));
}
$maxBytes = 500 * 1024 * 1024;
@@ -728,7 +720,7 @@ class DirectAdminMigration extends Page implements HasActions, HasForms
}
$name = (string) ($item['name'] ?? '');
if (! preg_match('/\\.(tar\\.zst|tar\\.gz|tgz)$/i', $name)) {
if (! preg_match('/\\.(tar\\.zst|zst|tar\\.gz|tgz)$/i', $name)) {
continue;
}

View File

@@ -12682,7 +12682,7 @@ function discoverDirectAdminBackup(string $backupPath, string $extractDir): arra
$accounts = [];
$tarArgs = '';
if (preg_match('/\\.tar\\.zst$/i', $backupPath)) {
if (preg_match('/\\.(tar\\.zst|zst)$/i', $backupPath)) {
$tarArgs = '--zstd';
} elseif (preg_match('/\\.(tar\\.gz|tgz)$/i', $backupPath)) {
$tarArgs = '-I pigz';
@@ -12725,7 +12725,7 @@ function discoverDirectAdminBackup(string $backupPath, string $extractDir): arra
// Check for multiple user backups (full server backup)
foreach ($fileList as $file) {
if (preg_match('/user\\.([a-z0-9_]+)\\.(?:tar\\.zst|tar\\.gz|tgz)$/i', $file, $matches)) {
if (preg_match('/user\\.([a-z0-9_]+)\\.(?:tar\\.zst|zst|tar\\.gz|tgz)$/i', $file, $matches)) {
$username = $matches[1];
// Extract just this user's backup
@@ -12735,7 +12735,7 @@ function discoverDirectAdminBackup(string $backupPath, string $extractDir): arra
$innerPath = "$extractDir/$innerBackup";
if (file_exists($innerPath)) {
$innerTarArgs = '';
if (preg_match('/\\.tar\\.zst$/i', $innerPath)) {
if (preg_match('/\\.(tar\\.zst|zst)$/i', $innerPath)) {
$innerTarArgs = '--zstd';
} elseif (preg_match('/\\.(tar\\.gz|tgz)$/i', $innerPath)) {
$innerTarArgs = '-I pigz';