AWScala icon indicating copy to clipboard operation
AWScala copied to clipboard

Expiration time not working

Open nykolaslima opened this issue 10 years ago • 3 comments

I'm trying to upload a file and set a expiration time to it.

    val metadata: ObjectMetadata = new ObjectMetadata()
    metadata.setContentLength(file.length)
    metadata.setExpirationTime(DateTime.now().plusMinutes(10).toDate)

    bucket.get.putObjectAsPublicRead(filename, file, metadata)

But when I check the file in the s3 bucket it doesn't have expiry date. It's some bug in AWScala or am I using it wrong?

nykolaslima avatar Jul 06 '15 20:07 nykolaslima

It's some bug in AWScala or am I using it wrong?

I'm not sure. Please figure out the cause if you have time.

seratch avatar Jul 13 '15 14:07 seratch

I need to debug it. But looks like a bug in AWScala

nykolaslima avatar Jul 13 '15 16:07 nykolaslima

This does not seem to be a bug in AWScala but a very poorly designed AWS SDK:

    /**
     * For internal use only. This will *not* set the object's expiration time,
     * and is only used to set the value in the object after receiving the value
     * in a response from S3.
     *
     * @param expirationTime
     *            The expiration time for the object.
     */
    public void setExpirationTime(Date expirationTime) {
        this.expirationTime = expirationTime;
    }

orium avatar Jun 22 '18 14:06 orium