Skip to content

Commit

Permalink
update name when restore to new name
Browse files Browse the repository at this point in the history
  • Loading branch information
David Christofas committed Jun 21, 2021
1 parent 91222b4 commit ca52763
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog/unreleased/trashbin-restore.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Enhancement: Increase trashbin restore API compatibility

* The precondition were not checked before doing a trashbin restore in the ownCloud dav API. Without the checks the API would behave differently compared to the oC10 API.
* The restore response was missing HTTP headers like `ETag`
* Update the name when restoring the file from trashbin to a new target name

https://github.com/cs3org/reva/pull/1795

4 changes: 4 additions & 0 deletions pkg/storage/utils/decomposedfs/tree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ func (t *Tree) RestoreRecycleItemFunc(ctx context.Context, key, restorePath stri
}

n.Exists = true
// update name attribute
if err := xattr.Set(nodePath, xattrs.NameAttr, []byte(n.Name)); err != nil {
return errors.Wrap(err, "Decomposedfs: could not set name attribute")
}

// delete item link in trash
if err = os.Remove(trashItem); err != nil {
Expand Down

0 comments on commit ca52763

Please sign in to comment.