public function checkConnexion($data = [])
{
$test = 'test' . time() . '-' . rand(1, 1000000);
- $testFile = $data['base_path'] . '/' . $test . '.txt';
+ $testFile = trim($data['base_path'], '/') . '/' . $test . '.txt';
$client = $this->createClient($data);
'bucket' => $data['bucket'] ?? $this->getServer()->getBucket(),
'endpoint' => $data['endpoint'] ?? $this->getServer()->getEndpoint(),
'base_path' => trim($data['base_path'] ?? $this->getServer()->getBasePath(), "/"),
+ 'provider' => $data['s3_provider'] ?? $this->getServer()->getS3Provider(),
];
return ['region' => $data['region'],
'version' => '2006-03-01',
- 'use_path_style_endpoint' => false,
+ 'endpoint' => $data['endpoint'],
+ 'use_path_style_endpoint' => static::usePathStyleEndpoint($data['provider']),
'credentials' => ['key' => $data['access_key'], 'secret' => $data['secret']]
];
}
+ public static function usePathStyleEndpoint($provider)
+ {
+ return $provider !== 'AWS';
+ }
+
protected function synchronizeFiles($source, $dest, $mirror = false, $dryrun = false)
{
$rclone = new Rclone();
- $rclone->setArg();
+ $rclone->setArg();
$rclone->setSrc($source);
$rclone->setDest(rtrim($this->getServer()->getBasePath(), '/') . '/' . trim($dest, '/') . '/');
$rclone->setMirror($mirror);