Skip to content

Commit

Permalink
internal/backend/fs: check errors on filepath.Walk
Browse files Browse the repository at this point in the history
Closes #1034.
  • Loading branch information
fsouza committed Jan 9, 2023
1 parent 3f88339 commit 6f64aff
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/backend/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,13 @@ func (s *storageFS) ListObjects(bucketName string, prefix string, versions bool)
defer s.mtx.RUnlock()

objects := []ObjectAttrs{}
// TODO: WalkDir more efficient?
bucketPath := filepath.Join(s.rootDir, url.PathEscape(bucketName))
if err := filepath.Walk(bucketPath, func(path string, info fs.FileInfo, _ error) error {
// Rel() should never return error since path always descend from bucketPath
if err := filepath.Walk(bucketPath, func(path string, info fs.FileInfo, err error) error {
if err != nil {
return err
}

objName, _ := filepath.Rel(bucketPath, path)
// TODO: should this check path?
if s.mh.isSpecialFile(info.Name()) {
return nil
}
Expand Down

0 comments on commit 6f64aff

Please sign in to comment.