Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s3file.slice methods always return entire object #16398

Closed
infrahead opened this issue Jan 14, 2025 · 2 comments · Fixed by #16400
Closed

s3file.slice methods always return entire object #16398

infrahead opened this issue Jan 14, 2025 · 2 comments · Fixed by #16400
Assignees
Labels
bug Something isn't working

Comments

@infrahead
Copy link

What version of Bun is running?

1.1.43+76800b049

What platform is your computer?

Linux 5.15.146.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

const s3 = new Bun.S3Client({
  // creds here
})

const partial = s3.file('example.json').slice(0, 1024)

// prints all bytes???
console.log(`range (bytes): ${await partial.bytes()}`)

// prints entire file???
console.log(`range: ${await partial.text()}`)

What is the expected behavior?

partial reads using range requests
https://bun.sh/docs/api/s3#partial-reads-with-slice

What do you see instead?

regardless of end offset passed, I get entire file back

Additional information

No response

@infrahead infrahead added bug Something isn't working needs triage labels Jan 14, 2025
@infrahead
Copy link
Author

I can see there are basic tests for this in https://github.com/oven-sh/bun/blob/main/test/js/bun/s3/s3.test.ts#L233 so I'm a little perplexed.

I'm passing bucket and region (instead of endpoint) in the constructor, and this is standard AWS S3 bucket

@cirospaciari
Copy link
Member

cirospaciari commented Jan 14, 2025

This is weird we added tests for this, but I found the bug and is when offset is set to 0, will open a PR fixing this ASAP.
EDIT: The issue will be closed when #16400 get merged. Thank you for the reporting, new test was added to make sure that no regression will come in future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants