From bfb92096897a7434534b9fdcf4ca5f891915fbed Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 1 Jun 2015 16:43:41 -0700 Subject: [PATCH] Skip files and weird directories from listBuckets(), allowing this so that minio fs mode can be used as ftp service --- pkg/storage/drivers/fs/fs_bucket.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/storage/drivers/fs/fs_bucket.go b/pkg/storage/drivers/fs/fs_bucket.go index 599de1a5a..003b73b0a 100644 --- a/pkg/storage/drivers/fs/fs_bucket.go +++ b/pkg/storage/drivers/fs/fs_bucket.go @@ -40,11 +40,19 @@ func (fs *fsDriver) ListBuckets() ([]drivers.BucketMetadata, error) { var metadataList []drivers.BucketMetadata for _, file := range files { if !file.IsDir() { - return []drivers.BucketMetadata{}, iodine.New(drivers.BackendCorrupted{Path: fs.root}, nil) + // if files found ignore them + continue } + if file.IsDir() { + // if directories found with odd names, skip them too + if !drivers.IsValidBucket(file.Name()) { + continue + } + } + metadata := drivers.BucketMetadata{ Name: file.Name(), - Created: file.ModTime(), // TODO - provide real created time + Created: file.ModTime(), } metadataList = append(metadataList, metadata) }