Browse Source

fix MongodbStore.ListDirectoryEntries panic on find failure

pull/2488/head
Bl1tz23 3 years ago
parent
commit
83bffca7e6
  1. 4
      weed/filer/mongodb/mongodb_store.go

4
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)

Loading…
Cancel
Save