avoid empty chunk view

This commit is contained in:
Chris Lu
2018-05-24 23:19:56 -07:00
parent d773e11c7a
commit e18c7e160c
2 changed files with 15 additions and 1 deletions

View File

@@ -66,7 +66,7 @@ func ReadFromChunks(chunks []*filer_pb.FileChunk, offset int64, size int) (views
stop := offset + int64(size)
for _, chunk := range visibles {
if chunk.start <= offset && offset < chunk.stop {
if chunk.start <= offset && offset < chunk.stop && offset < stop {
views = append(views, &ChunkView{
FileId: chunk.fileId,
Offset: offset - chunk.start, // offset is the data starting location in this file id