Skip to content

Commit

Permalink
Merge pull request #3857 from dragonchaser/issue-6245-nil-pointer
Browse files Browse the repository at this point in the history
Fix nil-pointer exception on trashbin purge
  • Loading branch information
dragonchaser authored May 8, 2023
2 parents 756a843 + 4bcaabc commit d8682ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-trashbin-purge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fix trashbin purge

We have fixed a nil-pointer-exception, when purging files from the trashbin that do not have a parent (any more)

https://github.com/cs3org/reva/pull/3857
https://github.com/owncloud/ocis/issues/6245
8 changes: 7 additions & 1 deletion pkg/storage/utils/decomposedfs/node/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,14 @@ func (p *Permissions) AssemblePermissions(ctx context.Context, n *Node) (ap prov
appctx.GetLogger(ctx).Error().Err(err).Interface("node", cn.ID).Msg("error reading permissions")
// continue with next segment
}

if cn, err = cn.Parent(); err != nil {
return ap, errors.Wrap(err, "Decomposedfs: error getting parent for node "+cn.ID)
// We get an error but get a parent, but can not read it from disk (eg. it has been deleted already)
if cn != nil {
return ap, errors.Wrap(err, "Decomposedfs: error getting parent for node "+cn.ID)
}
// We do not have a parent, so we assume the next valid parent is the spaceRoot (which must always exist)
cn = n.SpaceRoot
}
}

Expand Down

0 comments on commit d8682ab

Please sign in to comment.