diff options
| author | Bl1tz23 <alex3angle@gmail.com> | 2021-12-03 13:58:37 +0300 |
|---|---|---|
| committer | Bl1tz23 <alex3angle@gmail.com> | 2021-12-03 13:58:37 +0300 |
| commit | 83bffca7e6811afd67a869a5127ce83a9541063f (patch) | |
| tree | 8acfd33cd77284e4fa55ee3763155076829586a7 | |
| parent | 75e40134392f20a491e653118476f2ae237721f8 (diff) | |
| download | seaweedfs-83bffca7e6811afd67a869a5127ce83a9541063f.tar.xz seaweedfs-83bffca7e6811afd67a869a5127ce83a9541063f.zip | |
fix MongodbStore.ListDirectoryEntries panic on find failure
| -rw-r--r-- | weed/filer/mongodb/mongodb_store.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/weed/filer/mongodb/mongodb_store.go b/weed/filer/mongodb/mongodb_store.go index 1ef5056f4..6935be1ab 100644 --- a/weed/filer/mongodb/mongodb_store.go +++ b/weed/filer/mongodb/mongodb_store.go @@ -193,6 +193,10 @@ func (store *MongodbStore) ListDirectoryEntries(ctx context.Context, dirPath uti optLimit := int64(limit) opts := &options.FindOptions{Limit: &optLimit, Sort: bson.M{"name": 1}} cur, err := store.connect.Database(store.database).Collection(store.collectionName).Find(ctx, where, opts) + if err != nil { + return lastFileName, fmt.Errorf("failed to list directory entries: find error: %w", err) + } + for cur.Next(ctx) { var data Model err := cur.Decode(&data) |
