Skip to content

get_https_url generating negative expiry #188

@joshuamcginnis

Description

@joshuamcginnis

I'm attempting to generate a signed url for a file in S3; however, the url that get's returned always returns a negative expiry which causes the url to 400.

connection = Fog::Storage.new(
  region: 'us-west-1',
  provider: 'AWS',
  aws_access_key_id: ENV[AWS_ACCESS_KEY'],
  aws_secret_access_key: ENV['AWS_SECRET_KEY']
)
bucket = connection.directories.get(BUCKET)
file = 'test.jpg'
p file_url = bucket.files.get_https_url("uploads/#{file}", 300)

Generated URL:

https://account.s3-us-west-x.amazonaws.com/files/test.doc?X-Amz-Expires=-1443648781&X-Amz-Date=20150930T213801Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AAAVA***FA/20150930/us-west-x/s3/aws4_request&X
-Amz-SignedHeaders=host&X-Amz-Signature=e31663f9b2470e***215825d585b14c37e

Am I missing something here? Can you also confirm the units that the expiry arg should be in? (I'm presuming it is in in ms)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions