storj / storj

Ongoing Storj v3 development. Decentralized cloud object storage that is affordable, easy to use, private, and secure.
https://storj.io
GNU Affero General Public License v3.0
2.94k stars 395 forks source link

Uplink is not deleting prefix #4525

Closed mniewrzal closed 1 month ago

mniewrzal commented 2 years ago

I'm trying remove a prefix "test2"

OBJ                            0             test2/hello-storj/.idea/encodings.xml
OBJ                            0             test2/hello-storj/.idea/compiler.xml
OBJ                            0             test2/hello-storj/.idea/modules.xml
OBJ                            0             test2/hello-storj/.idea/copyright/profiles_settings.xml
OBJ                            0             test2/hello-storj/.idea/vcs.xml

Command I executed

[wywrzal@lapex rclone]$ uplink rm sj://michal/test2/
removed sj://michal/test2/

but nothing was removed. I also noticed that no matter what I type it will say its removed.

[wywrzal@lapex rclone]$ uplink rm bla
removed bla
Erikvv commented 2 years ago

Doesn't seem right to remove multiple objects without the user explicitly asking for that

uplinkng has a flag --recursive

mniewrzal commented 2 years ago

Most probably but at least I would expect different result output. I would like to know that nothing was removed at the end.

Erikvv commented 2 years ago

This is libuplink behavior.

Not returning ErrObjectNotFound is justified by some so that the operation is idempotent. I agree with you that it should give an error but I was not able to convince others about this, I think @egonelbre but he wasn't the only one.

Erikvv commented 2 years ago

By the way you can distinguish between these situations: if the object existed, DeleteObject will return Object metadata, else it will be null.

But if we want to rely on this behavior we should document this at https://pkg.go.dev/storj.io/uplink#Project.DeleteObject

mniewrzal commented 2 years ago

Yes, this is the only way we can figure out that something was really deleted. I will make a thicket to improve go doc for DeleteObject.

iglesiasbrandon commented 1 month ago

this issue is stale, if this comes up we will open a new issue.