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

Customisable expiration for s3 backend #1222

Open
Mogost opened this issue Feb 20, 2023 · 0 comments · May be fixed by #1226
Open

Customisable expiration for s3 backend #1222

Mogost opened this issue Feb 20, 2023 · 0 comments · May be fixed by #1226

Comments

@Mogost
Copy link

Mogost commented Feb 20, 2023

I would like to be able to modify the behavior in terms of generating pre-signed urls.
Now the generation of pre-signed URLs is based on the current time.
This leads to the fact that the user refreshing the page will receive each time a new link and the browser cache in his case does not work.
In order to override this behavior, it's essentially copying a lot of code, which I'd like to avoid.

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)

I want to override this in order to have discrete values of expiration time, acting over some period of time.

It would be nice to have something like this to be able to modify behavior

...
def get_expiration(expire):
    return datetime.utcnow() + timedelta(seconds=expire)
...
expiration = self.get_expiration(expire)

image

@Mogost Mogost linked a pull request Mar 28, 2023 that will close this issue
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.

1 participant