diff --git a/storages/backends/gcloud.py b/storages/backends/gcloud.py index 6b9b60627..c40c12ed9 100644 --- a/storages/backends/gcloud.py +++ b/storages/backends/gcloud.py @@ -297,7 +297,7 @@ def get_created_time(self, name): created = blob.time_created return created if setting('USE_TZ') else timezone.make_naive(created) - def url(self, name): + def url(self, name, parameters=None): """ Return public url or a signed url for the Blob. This DOES NOT check for existance of Blob - that makes codes too slow @@ -309,6 +309,8 @@ def url(self, name): no_signed_url = ( blob_params.get('acl', self.default_acl) == 'publicRead' or not self.querystring_auth) + params = parameters or {} + if not self.custom_endpoint and no_signed_url: return blob.public_url elif no_signed_url: @@ -318,13 +320,14 @@ def url(self, name): ) elif not self.custom_endpoint: return blob.generate_signed_url( - expiration=self.expiration, version="v4" + expiration=self.expiration, version="v4", **params ) else: return blob.generate_signed_url( bucket_bound_hostname=self.custom_endpoint, expiration=self.expiration, version="v4", + **params ) def get_available_name(self, name, max_length=None):