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

AWS S3 ACL and Scheme settings? #118

Open
timReynolds opened this issue Jan 27, 2015 · 3 comments
Open

AWS S3 ACL and Scheme settings? #118

timReynolds opened this issue Jan 27, 2015 · 3 comments

Comments

@timReynolds
Copy link

Is anyone using the AWS S3 adaptor with ACL set to anything other than the default? When trying to use it with something like authenticated-read I don't get a signed response back. This seems to be down to the fact the following code doesn't specify an expiry;

    /**
     * Return the url for a file upload.
     *
     * @param  string $styleName
     * @return string
     */
    public function url($styleName)
    {
        return $this->s3Client->getObjectUrl($this->attachedFile->s3_object_config['Bucket'], $this->path($styleName));
    }

Which based on my reading of the AWS docs is needed to get a pre-signed url which I believe is needed for anything other than public read.

Has anyone else had this issue? More than happy to make the required changes but wasn't convinced I correctly understood the code base.

@timReynolds
Copy link
Author

For reference the S3 client method logic is;

    public function getObjectUrl($bucket, $key, $expires = null, array $args = array())
    {
        $command = $this->getCommand('GetObject', $args + array('Bucket' => $bucket, 'Key' => $key));
        if ($command->hasKey('Scheme')) {
            $scheme = $command['Scheme'];
            $request = $command->remove('Scheme')->prepare()->setScheme($scheme)->setPort(null);
        } else {
            $request = $command->prepare();
        }
        return $expires ? $this->createPresignedUrl($request, $expires) : $request->getUrl();
    }

@flaxandteal
Copy link

Apologies for re-awakening an old issue, but rather than starting a new one when this is still open - I have a fork with expiring-url functionality. I am happy to prepare a pull request if it would be helpful?

@Dylan-Buth
Copy link

Dylan-Buth commented May 24, 2016

@flaxandteal Did you ever create that pull request? Maybe I'm missing it but I can't find a way to display the private PDF on s3 to the user.

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

2 participants