Skip to content

Commit

Permalink
Do not return an error when trying to list a non-existent trashbin
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Jul 26, 2024
1 parent 746fbe0 commit 6e35520
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/storage/fs/posix/trashbin/trashbin.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,17 @@ func (tb *Trashbin) ListRecycle(ctx context.Context, ref *provider.Reference, ke
base = filepath.Join(base, key+".trashitem", relativePath)
}

items := []*provider.RecycleItem{}
entries, err := os.ReadDir(filepath.Clean(base))
if err != nil {
return nil, err
switch err.(type) {
case *os.PathError:
return items, nil
default:
return nil, err
}
}

items := []*provider.RecycleItem{}
for _, entry := range entries {
key := strings.TrimSuffix(entry.Name(), ".trashitem")
originalPath, ts, err := tb.readInfoFile(trashRoot, key)
Expand Down

0 comments on commit 6e35520

Please sign in to comment.