abashev / vfs-s3

Amazon S3 driver for Apache commons-vfs (Virtual File System) project
Apache License 2.0
93 stars 50 forks source link

Getting the last modified timestamp returns different results #72

Open boris-petrov opened 3 years ago

boris-petrov commented 3 years ago

When using DigitalOcean Spaces, requesting the last modified time in these two ways yields two different results:

def fileSystemOptions = new FileSystemOptions()
S3FileSystemConfigBuilder.getInstance().setCredentialsProvider(fileSystemOptions,
    new AWSStaticCredentialsProvider(new BasicAWSCredentials('username', 'password')))

def file = VFS.getManager().resolveFile('s3://ams3.digitaloceanspaces.com/folder', fileSystemOptions)
println file.getChildren()[0].getContent().getLastModifiedTime()

file = VFS.getManager().resolveFile('s3://ams3.digitaloceanspaces.com/folder/file.txt', fileSystemOptions)
println file.getContent().getLastModifiedTime()

In my case I get:

1575469137773
1575469137000

That is, when getting the file directly, the timestamp is truncated. This is not a bug in vfs-s3 but rather in DigitalOcean. However, a workaround in vfs-s3 would be nice.