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

streamDecrypt not working for custom disk using "S3" driver #26

Open
muarachmann opened this issue Feb 2, 2023 · 1 comment
Open

streamDecrypt not working for custom disk using "S3" driver #26

muarachmann opened this issue Feb 2, 2023 · 1 comment

Comments

@muarachmann
Copy link

muarachmann commented Feb 2, 2023

Using the code doesn't download the file.

       return
            response()->streamDownload(function () use ($decFilename) {
                FileVault::disk('s3')->streamDecrypt($decFilename);
            }, Str::replaceLast('.enc', '', basename($decFilename)));

I keep getting the error ** Failed to open stream: No such file or directory** meanwhile the upload to bucket works and the file is actually there in the bucket. Using Local bucket, it works fine but doesn't work with the s3 driver.

@muarachmann muarachmann changed the title streamDecrypt not working for s3 streamDecrypt not working for custom disk using "S3" driver Feb 4, 2023
@muarachmann
Copy link
Author

muarachmann commented Feb 4, 2023

Update on this @soarecostin
I noticed it was because I am using a custom disk configuration. e.g

'test-disk' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
            'endpoint' => env('AWS_ENDPOINT'),
        ],

The streamDecrypt doesn't work as it fails to check if the disk is actually using the s3 driver here

return $this->disk == 's3';

here this->disk returns test-disk and thus fails with file not found.

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