Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public ReadableByteChannel fetch(ObjectKey key, ByteRange range) throws StorageB
final long contentLength = range == null
? blob.getSize()
: Math.min(range.size(), blob.getSize() - range.offset());
final int length = SizedReadableByteChannel.exactLength(key, contentLength);

final ReadChannel reader = blob.reader();
// A chunk size of 0 makes the client read straight into the destination buffer.
Expand All @@ -163,7 +164,7 @@ public ReadableByteChannel fetch(ObjectKey key, ByteRange range) throws StorageB
reader.limit(range.endOffset() + 1);
reader.seek(range.offset());
}
return SizedReadableByteChannel.of(reader, SizedReadableByteChannel.exactLength(key, contentLength));
return SizedReadableByteChannel.of(reader, length);
} catch (final IOException e) {
throw new StorageBackendException("Failed to fetch " + key, e);
} catch (final BaseServiceException e) {
Expand Down
Loading