From 8bb30d50f34f63b098dc88d385eda896e6bc94a3 Mon Sep 17 00:00:00 2001 From: Ciro Spaciari Date: Tue, 14 Jan 2025 13:29:56 -0800 Subject: [PATCH] fix slice with offset 0 --- src/s3/client.zig | 2 -- test/js/bun/s3/s3.test.ts | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/s3/client.zig b/src/s3/client.zig index 684ae76ca4eb3e..80231c3d870b08 100644 --- a/src/s3/client.zig +++ b/src/s3/client.zig @@ -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; diff --git a/test/js/bun/s3/s3.test.ts b/test/js/bun/s3/s3.test.ts index a99103198076e8..2470297eb0ef91 100644 --- a/test/js/bun/s3/s3.test.ts +++ b/test/js/bun/s3/s3.test.ts @@ -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);