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

Allow empty prefix for {Public,Protected}Adapter #36

Conversation

omoustaouda
Copy link

The prefix is not always used in the adapters.

This PR allows to make it optional.

an example where no prefix is used is (last line):

---
Name: custom-silverstripe-s3
After:
  - '#silverstripes3-flysystem'
---
SilverStripe\Core\Injector\Injector:
  Aws\S3\S3Client:
    constructor:
      configuration:
        region: eu-central-1
        version: latest
        credentials:
          key: '`AWS_ACCESS_KEY_ID`'
          secret: '`AWS_SECRET_ACCESS_KEY`'
  SilverStripe\S3\Adapter\PublicAdapter:
    constructor:
      s3Client: '%$Aws\S3\S3Client'
      bucket: '`AWS_BUCKET_NAME`'
      prefix: '' # <---- HERE no prefix is being used

@obj63mc
Copy link
Collaborator

obj63mc commented Jan 21, 2020

With SS and the way they secure your file assets (published/unpublished) you have to have some sort of prefix so that protected assets and public assets live in different directories, allowing you to be able to configure the buckets security policy properly.

Simply setting the prefix to nothing and having everything upload to the root would cause possible issues if you have say an unpublished file with the same name as a published file. They could potentially overwrite themselves. Also if all the assets are in the same directory, technically protected (unpublished assets) could be accessed by anyone if they new the file name.

@obj63mc obj63mc closed this Jan 21, 2020
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

Successfully merging this pull request may close these issues.

None yet

2 participants