From 79af6b41d450d10f3eaa6c6de40d838610e73e9d Mon Sep 17 00:00:00 2001 From: wusong <75450248+wusongANKANG@users.noreply.github.com> Date: Wed, 15 Feb 2023 23:18:56 +0800 Subject: [PATCH] [mount] Fix read file-data in entry.content (#4207) --- weed/mount/filehandle_read.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weed/mount/filehandle_read.go b/weed/mount/filehandle_read.go index be6d5d984..0684d0ba4 100644 --- a/weed/mount/filehandle_read.go +++ b/weed/mount/filehandle_read.go @@ -53,7 +53,7 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, int64, e return 0, 0, io.EOF } - if offset+int64(len(buff)) <= int64(len(entry.Content)) { + if offset < int64(len(entry.Content)) { totalRead := copy(buff, entry.Content[offset:]) glog.V(4).Infof("file handle read cached %s [%d,%d] %d", fileFullPath, offset, offset+int64(totalRead), totalRead) return int64(totalRead), 0, nil