dwilkie / carrierwave_direct

Process your uploads in the background by uploading directly to S3
MIT License
839 stars 181 forks source link

Convert expiration time in policy to an ISO8601 string #189

Closed stuartmenefy closed 8 years ago

stuartmenefy commented 8 years ago

Relying on the default Time#to_json may or may not result in a date which is ISO8601 format, which is required by Amazon.

Using Active Support appears to do the right thing. However using the default JSON gem results in:

<Error>
<Code>InvalidPolicyDocument</Code>
<Message>
Invalid Policy: Invalid 'expiration' value: '2015-10-17 03:15:59 UTC'
</Message>
</Error>

Similarly if using a custom JSON conversion this could cause problems. So add an explicit ISO8601 conversion.

This is the same problem and fix proposed by @asmatameem in pull request https://github.com/dwilkie/carrierwave_direct/pull/96 this time with a test.

fabn commented 8 years ago

Good, thanks.