carrierwaveuploader / carrierwave-aws

AWS-SDK storage adapter for CarrierWave
MIT License
409 stars 107 forks source link

AWS attributes: dynamic evaluation? #145

Closed milgner closed 5 years ago

milgner commented 5 years ago

The README states

  # Set custom options such as cache control to leverage browser caching
  config.aws_attributes = {
    expires: 1.week.from_now.httpdate,
    cache_control: 'max-age=604800'
  }

However, the statement 1.week.from_now.httpdate will return a static, absolute timestamp which is then merged verbatim into the request. So when an application runs for a couple of days, the expires string will move closer and closer, eventually even moving into the past.

It should be straightforward to also have this support a lambda or Proc instead of a static hash, so it can be evaluated on every request. What do you think about this?

ymek commented 5 years ago

Noting this issue as resolved - an associated PR has been merged.

sorentwo commented 5 years ago

Thanks for noting it has been fixed. It slipped through the cracks.