Skip to content

Commit

Permalink
fix: open_basedir issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kellymears committed Sep 6, 2023
1 parent 7f21f64 commit d0a2355
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Uploads/Uploads.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,16 @@ public function registerStreamWrapper(): void
public function configureClient(): void
{
$clientParams = apply_filters('s3_uploads_s3_client_params', [
'version' => "latest",
'signature' => $this->signature,
'region' => $this->region,
'endpoint' => $this->endpoint,
'csm' => false,
'credentials' => [
'key' => $this->key,
'secret' => $this->secret,
],
'csm' => false,
'use_aws_shared_config_files' => false,
'endpoint' => $this->endpoint,
'region' => $this->region,
'signature' => $this->signature,
'version' => 'latest',
]);

$this->client = new S3Client($clientParams);
Expand Down Expand Up @@ -158,10 +159,10 @@ public function filterUploadDir(array $dirs): array
{
$this->localUploadDir = $dirs;

$dirs['path'] = str_replace(WP_CONTENT_DIR, $this->bucketPath, $dirs['path']);
$dirs['path'] = str_replace(WP_CONTENT_DIR, $this->bucketPath, $dirs['path']);
$dirs['basedir'] = str_replace(WP_CONTENT_DIR, $this->bucketPath, $dirs['basedir']);

$dirs['url'] = str_replace("s3://{$this->bucket}", $this->bucketUrl, $dirs['path']);
$dirs['url'] = str_replace("s3://{$this->bucket}", $this->bucketUrl, $dirs['path']);
$dirs['baseurl'] = str_replace("s3://{$this->bucket}", $this->bucketUrl, $dirs['basedir']);

return apply_filters('s3_uploads_dirs', $dirs);
Expand Down

0 comments on commit d0a2355

Please sign in to comment.