mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-12-21 11:00:08 +08:00
fix MongodbStore.ListDirectoryEntries panic on find failure
This commit is contained in:
@@ -193,6 +193,10 @@ func (store *MongodbStore) ListDirectoryEntries(ctx context.Context, dirPath uti
|
|||||||
optLimit := int64(limit)
|
optLimit := int64(limit)
|
||||||
opts := &options.FindOptions{Limit: &optLimit, Sort: bson.M{"name": 1}}
|
opts := &options.FindOptions{Limit: &optLimit, Sort: bson.M{"name": 1}}
|
||||||
cur, err := store.connect.Database(store.database).Collection(store.collectionName).Find(ctx, where, opts)
|
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) {
|
for cur.Next(ctx) {
|
||||||
var data Model
|
var data Model
|
||||||
err := cur.Decode(&data)
|
err := cur.Decode(&data)
|
||||||
|
|||||||
Reference in New Issue
Block a user