Skip to content

Commit

Permalink
GODRIVER-2204: Add chunkIndex workaround to fillBuffer (#783)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabbyasuncion committed Nov 3, 2021
1 parent 1715097 commit 5089f6f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mongo/gridfs/download_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,14 @@ func (ds *DownloadStream) fillBuffer(ctx context.Context) error {
return err
}

if chunkIndex.Int32() != ds.expectedChunk {
var chunkIndexInt32 int32
if chunkIndexInt64, ok := chunkIndex.Int64OK(); ok {
chunkIndexInt32 = int32(chunkIndexInt64)
} else {
chunkIndexInt32 = chunkIndex.Int32()
}

if chunkIndexInt32 != ds.expectedChunk {
return ErrWrongIndex
}

Expand Down

0 comments on commit 5089f6f

Please sign in to comment.