Skip to content

Commit

Permalink
fix slice with offset 0
Browse files Browse the repository at this point in the history
  • Loading branch information
cirospaciari committed Jan 14, 2025
1 parent e5ea345 commit a6b53d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/s3/client.zig
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ pub fn downloadSlice(
) void {
const range = brk: {
if (size) |size_| {
if (offset == 0) break :brk null;

var end = (offset + size_);
if (size_ > 0) {
end -= 1;
Expand Down
5 changes: 5 additions & 0 deletions test/js/bun/s3/s3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ for (let credentials of allCredentials) {
const text = await file.slice(6, 10).text();
expect(text).toBe("Bun!");
});
it("should download range with 0 offset", async () => {
const file = bucket.file(tmp_filename, options);
const text = await file.slice(0, 5).text();
expect(text).toBe("Hello");
});

it("should check if a key exists or content-length", async () => {
const file = bucket.file(tmp_filename, options);
Expand Down

0 comments on commit a6b53d7

Please sign in to comment.