diff --git a/internal/http/services/owncloud/ocdav/trashbin.go b/internal/http/services/owncloud/ocdav/trashbin.go index e931bef3124..561e58c7dab 100644 --- a/internal/http/services/owncloud/ocdav/trashbin.go +++ b/internal/http/services/owncloud/ocdav/trashbin.go @@ -117,12 +117,13 @@ func (h *TrashbinHandler) Handler(s *svc) http.Handler { h.restore(w, r, s, u, dst, key) return } - if key != "" && r.Method == "DELETE" { + + if r.Method == "DELETE" { h.delete(w, r, s, u, key) return } - http.Error(w, "501 Forbidden", http.StatusNotImplemented) + http.Error(w, "501 Not implemented", http.StatusNotImplemented) }) } diff --git a/pkg/storage/fs/ocis/recycle.go b/pkg/storage/fs/ocis/recycle.go index 577298cf089..16fe11c4db0 100644 --- a/pkg/storage/fs/ocis/recycle.go +++ b/pkg/storage/fs/ocis/recycle.go @@ -233,14 +233,15 @@ func (fs *ocisfs) PurgeRecycleItem(ctx context.Context, key string) (err error) } func (fs *ocisfs) EmptyRecycle(ctx context.Context) error { + u, ok := user.ContextGetUser(ctx) // TODO what permission should we check? we could check the root node of the user? or the owner permissions on his home root node? - // The current impl will wipe your own trash. or when enable home is false the trash of the 'root' - if fs.o.EnableHome { - u := user.ContextMustGetUser(ctx) - // TODO use layout, see Tree.Delete() for problem - return os.RemoveAll(filepath.Join(fs.o.Root, "trash", u.Id.OpaqueId)) + // The current impl will wipe your own trash. or when no user provided the trash of 'root' + if !ok { + return os.RemoveAll(fs.getRecycleRoot(ctx)) } - return os.RemoveAll(fs.getRecycleRoot(ctx)) + + // TODO use layout, see Tree.Delete() for problem + return os.RemoveAll(filepath.Join(fs.o.Root, "trash", u.Id.OpaqueId)) } func getResourceType(isDir bool) provider.ResourceType {