(size int64, file model.File)
| 122 | } |
| 123 | |
| 124 | func GetRangeReaderFromMFile(size int64, file model.File) *model.FileRangeReader { |
| 125 | return &model.FileRangeReader{ |
| 126 | RangeReaderIF: RangeReaderFunc(func(ctx context.Context, httpRange http_range.Range) (io.ReadCloser, error) { |
| 127 | length := httpRange.Length |
| 128 | if length < 0 || httpRange.Start+length > size { |
| 129 | length = size - httpRange.Start |
| 130 | } |
| 131 | return &model.FileCloser{File: io.NewSectionReader(file, httpRange.Start, length)}, nil |
| 132 | }), |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | // 139 cloud does not properly return 206 http status code, add a hack here |
| 137 | func checkContentRange(header *http.Header, offset int64) bool { |
no test coverage detected