Browse Source
Merge pull request #2488 from Bl1tz23/master
MongodbStore.ListDirectoryEntries panics on Find method failure
pull/2500/head
Chris Lu
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
0 deletions
-
weed/filer/mongodb/mongodb_store.go
|
@ -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) |
|
|