Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with S3 + Encryption on file rename #62

Open
hardikaspl opened this issue Jun 26, 2020 · 0 comments
Open

Issue with S3 + Encryption on file rename #62

hardikaspl opened this issue Jun 26, 2020 · 0 comments

Comments

@hardikaspl
Copy link

hardikaspl commented Jun 26, 2020

I have faced file rename issue when encryption is set as 'null' like following:

//servocoder/richfilemanager-php/src/Repository/S3/StorageHelper.php
public $encryption = null;

//servocoder/richfilemanager-php/src/Repository/S3/Storage.php
public function copyItem($source, $target, $remove = false)
 {
     $context = stream_context_create([
         's3' => array_merge($source->getAclParams(), [
             'ServerSideEncryption' => $this->s3->encryption,
         ]),
     ]);

     $copied = copy($source->getAbsolutePath(), $target->getAbsolutePath(), $context);

     if ($copied && $remove === true) {
         $this->s3->delete($source->getDynamicPath());
     }

     return $copied;
 }

So, when $this->s3->encryption is 'null' it does not copy the file and it eventually deletes the source file as per following:

   if ($copied && $remove === true) {
       $this->s3->delete($source->getDynamicPath());
   }

But if i remove 'ServerSideEncryption' parameter or if i set public $encryption = 'AES256'; it works. like following:

$context = stream_context_create([
  's3' => array_merge($source->getAclParams(), [
    // 'ServerSideEncryption' => $this->s3->encryption,
   ]),
]);

Or

public $encryption = 'AES256';

$context = stream_context_create([
  's3' => array_merge($source->getAclParams(), [
    'ServerSideEncryption' => $this->s3->encryption,
   ]),
]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant