Skip to content

Commit

Permalink
Fix trash-bin purge
Browse files Browse the repository at this point in the history
  • Loading branch information
IljaN committed Jan 14, 2021
1 parent f2b63bf commit 7d2cd9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions internal/http/services/owncloud/ocdav/trashbin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

Expand Down
12 changes: 6 additions & 6 deletions pkg/storage/fs/ocis/recycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,12 @@ func (fs *ocisfs) PurgeRecycleItem(ctx context.Context, key string) (err error)
func (fs *ocisfs) EmptyRecycle(ctx context.Context) error {
// 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))
}
return os.RemoveAll(fs.getRecycleRoot(ctx))
//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))
//}
//return os.RemoveAll(fs.getRecycleRoot(ctx))
}

func getResourceType(isDir bool) provider.ResourceType {
Expand Down

0 comments on commit 7d2cd9c

Please sign in to comment.