ruby aws sdk s3 deletion of objects in folders

时间:2015-06-30 13:57:45

标签: ruby amazon-s3 aws-sdk

I'm using the aws sdk to delete an object (or objects) from a bucket, the problem is that keys that don't exist still get counted as successfully deleted, shouldn't the SDK raise an error that the key doesn't exist?

The other problem is that an object corresponding to a key that does exist isn't being removed but is returning as being successfully deleted.

EDIT:

The second problem only seems to be when the object to be deleted is inside of a folder, in the root it gets deleted fine.

2 个答案:

答案 0 :(得分:0)

即使目标对象不存在,Amazon S3的DELETE对象操作也会故意返回200 OK。这是因为它在设计上是幂等的。出于这个原因,NSFileManager gem将在相同的情况下返回成功的响应。

快速澄清正斜线。您可以拥有任意数量的' /'密钥开头的字符,但前面有' /'与没有的对象不同。例如:

aws-sdk

请确定是否选择使用斜杠。

答案 1 :(得分:-1)

说明你可以拥有的' /'在密钥的开头,我没有意识到,不确定为什么它在那里,但它搞砸了密钥。