Skip to content

Commit 5089f6f

Browse files
committed
GODRIVER-2204: Add chunkIndex workaround to fillBuffer (#783)
1 parent 1715097 commit 5089f6f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

mongo/gridfs/download_stream.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,14 @@ func (ds *DownloadStream) fillBuffer(ctx context.Context) error {
242242
return err
243243
}
244244

245-
if chunkIndex.Int32() != ds.expectedChunk {
245+
var chunkIndexInt32 int32
246+
if chunkIndexInt64, ok := chunkIndex.Int64OK(); ok {
247+
chunkIndexInt32 = int32(chunkIndexInt64)
248+
} else {
249+
chunkIndexInt32 = chunkIndex.Int32()
250+
}
251+
252+
if chunkIndexInt32 != ds.expectedChunk {
246253
return ErrWrongIndex
247254
}
248255

0 commit comments

Comments
 (0)