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

parameters are ignored if s3 custom URL is provided #997

Closed
dannysauer opened this issue Apr 2, 2021 · 1 comment
Closed

parameters are ignored if s3 custom URL is provided #997

dannysauer opened this issue Apr 2, 2021 · 1 comment

Comments

@dannysauer
Copy link
Contributor

def url(self, name, parameters=None, expire=None, http_method=None):
# Preserve the trailing slash after normalizing the path.
name = self._normalize_name(self._clean_name(name))
if expire is None:
expire = self.querystring_expire
if self.custom_domain:
url = "{}//{}/{}".format(
self.url_protocol, self.custom_domain, filepath_to_uri(name))
if self.querystring_auth and self.cloudfront_signer:
expiration = datetime.utcnow() + timedelta(seconds=expire)
return self.cloudfront_signer.generate_presigned_url(url, date_less_than=expiration)
return url
params = parameters.copy() if parameters else {}
params['Bucket'] = self.bucket.name
params['Key'] = name
url = self.bucket.meta.client.generate_presigned_url('get_object', Params=params,
ExpiresIn=expire, HttpMethod=http_method)
if self.querystring_auth:
return url
return self._strip_signing_parameters(url)

If additional parameters are passed in to the url method when a custom_url is in use (like when S3 is behind CloudFront), they're ignored on the generated URL. They're already passed in as a dict, so they could easily be passed in to urllib.parse.urlunparse instead of using a format string when the URL is built (which might be a good fix anyway).

@dannysauer dannysauer changed the title parameters are ignores if s3 custom URL is provided parameters are ignored if s3 custom URL is provided Apr 2, 2021
dannysauer added a commit to Kong/docker-pulp that referenced this issue Apr 7, 2021
Add patch to append query string (work around jschneier/django-storages#997)
Update Makefile to build locally
Roll back pyYAML version which requires a pulp-core version bump
dannysauer added a commit to Kong/docker-pulp that referenced this issue Apr 7, 2021
Add patch to append query string (work around jschneier/django-storages#997)
Update Makefile to build locally
Roll back pyYAML version which requires a pulp-core version bump
dannysauer added a commit to Kong/docker-pulp that referenced this issue Apr 9, 2021
Add patch to append query string (work around jschneier/django-storages#997)
Don't add duplicate entries to query string
Update Makefile to build locally
Roll back pyYAML version which requires a pulp-core version bump
Tweaked dockerfile caching to eventually make dnf part of builds less horrible
@jschneier
Copy link
Owner

Resolved by #1054

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 a pull request may close this issue.

2 participants