Skip to content

Settings in GCP_STORAGE_EXTRA_STORES not being applied to stores #39

Open
@cortadocodes

Description

@cortadocodes

Bug report

What is the current behavior?

I'm using the GCP_STORAGE_EXTRA_STORES option in a django app to allow image uploads to a public bucket from an ImageField. As it's a public bucket, I'd like the URL returned for the images to be an unsigned public URL. I set up the option like this:

GCP_STORAGE_EXTRA_STORES = {
    "store-name": {
        "bucket_name": "bucket-name",
        "default_acl": "publicRead",
        "querystring_auth": False,
    },
}

and the image field like this:

 image = ImageField(
    upload_to="directory-name",
    storage=GoogleCloudStorage(store_key="store-name"),
    blank=True,
    null=True,
)

but I'm still getting signed URLs returned for the images uploaded.

As a workaround, I've had to manually add the options to the image field like this:

 image = ImageField(
    upload_to="user_images",
    storage=GoogleCloudStorage(store_key="profile_images", default_acl=None, querystring_auth=False),
    blank=True,
    null=True,
)

What is the expected behavior?

I should be able to set the options in the django settings files for the extra store and get public unsigned URLs returned for images uploaded to the image field. I shouldn't have to manually set the options in the model that the image field belongs to.

Your environment

  • Library Version: 0.9.1
  • Platform: Linux container

Metadata

Metadata

Assignees

Labels

bugUnintended behaviour in any area of the app

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions