Plugins base (#613)

* wip

* wip

* cleanup

* notification channels

* phpstan

* services

* remove server types

* refactoring

* refactoring
This commit is contained in:
Saeed Vaziry
2025-06-14 14:35:18 +02:00
committed by GitHub
parent adc0653d15
commit 131b828807
311 changed files with 3976 additions and 2660 deletions

View File

@ -4,13 +4,10 @@
use App\Exceptions\SSHCommandError;
use App\Exceptions\SSHError;
use App\SSH\HasS3Storage;
use Illuminate\Support\Facades\Log;
class S3 extends AbstractStorage
{
use HasS3Storage;
/**
* @throws SSHError
*/
@ -89,4 +86,25 @@ public function delete(string $src): void
'delete-from-s3'
);
}
/**
* @throws SSHError
*/
private function prepareS3Path(string $path, string $prefix = ''): string
{
$path = trim($path);
$path = ltrim($path, '/');
$path = preg_replace('/[^a-zA-Z0-9\-_\.\/]/', '_', $path);
$path = preg_replace('/\/+/', '/', (string) $path);
if ($prefix !== '' && $prefix !== '0') {
return trim($prefix, '/').'/'.$path;
}
if ($path === null) {
throw new SSHError('Invalid S3 path');
}
return $path;
}
}