mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-20 02:11:36 +00:00
21 lines
429 B
PHP
21 lines
429 B
PHP
<?php
|
|
|
|
namespace App\SSH;
|
|
|
|
trait HasS3Storage
|
|
{
|
|
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('/\/+/', '/', $path);
|
|
|
|
if ($prefix) {
|
|
$path = trim($prefix, '/').'/'.$path;
|
|
}
|
|
|
|
return $path;
|
|
}
|
|
}
|