Skip to content

Commit 6597bd7

Browse files
GODRIVER-2204: Add chunkIndex workaround to fillBuffer (#783)
1 parent 34dde80 commit 6597bd7

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
@@ -243,7 +243,14 @@ func (ds *DownloadStream) fillBuffer(ctx context.Context) error {
243243
return err
244244
}
245245

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

0 commit comments

Comments
 (0)