Skip to content

Commit

Permalink
Fix nil-pointer on trashbin purge
Browse files Browse the repository at this point in the history
Co-authored-by: Julian Koberg <[email protected]>
Co-authored-by: Michael Barz <[email protected]>
Co-authored-by: Jörn Dreyer <[email protected]>

Signed-off-by: Christian Richter <[email protected]>
  • Loading branch information
dragonchaser committed May 8, 2023
1 parent 756a843 commit 676deab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-trashbin-purge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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/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 676deab

Please sign in to comment.