mia icon indicating copy to clipboard operation
mia copied to clipboard

Claims delete succeeded if there was nothing to delete

Open anowell opened this issue 9 years ago • 4 comments

$ algo rm .my/foo/bar.jpg
Deleted file data://.my/foo/bar.jpg
$ algo rm .my/foo/bar.jpg
Deleted file data://.my/foo/bar.jpg

anowell avatar Nov 23 '16 19:11 anowell

That is a feature :)

Argoday avatar Nov 23 '16 19:11 Argoday

haha.. i was trying to delete a file with a long filename, and was a bit annoyed that it was still there after I "successfully" delete it... until I finally spotted the typo...

anowell avatar Nov 23 '16 19:11 anowell

The issue was it would require a second backend api call to s3 (/ data store) for each delete if we wanted to pass back an indicator of if the file previously existed (s3's delete api doesn't tell you)

Argoday avatar Nov 23 '16 19:11 Argoday

interesting... I had forgotten that... though it makes me wonder if the API should stop returning a deleted count, because this is quite confusing given that the second response is not true for most reasonable interpretations of "deleted": 1:

$ curl -H 'Authorization: Simple ...' -X DELETE https://api.algorithmia.com/v1/data/.my/foo/bar.jpg
{"result":{"deleted":1}}%                                                                                                                                                       

$ curl -H 'Authorization: Simple ...' -X DELETE https://api.algorithmia.com/v1/data/.my/foo/bar.jpg
{"result":{"deleted":1}}%               

anowell avatar Nov 23 '16 19:11 anowell