slack-ruby / slack-ruby/slack-ruby-client
After `client.files_upload`, `message.file.size != message.file["size"]`
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.3k
- Forks
- 222
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 3
Description
message = client.files_upload(
channels: '\#dev',
as_user: true,
file: UploadIO.new('./test.txt', 'text/plain'),
title: 'test.txt',
filename: 'test.txt',
initial_comment: 'testing'
)
File.open('./test.txt').size # 27
message.file.size # 35
message.file["size"] # 27
message.file.size is then different from message.file["size"]. The latter is both what is shown when printing message.file to the console, and appears to be the actual size of the file. Not sure what the former actually is.
What's going on? Should this be what's going on?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the client.files_upload example with UploadIO and inspect the returned message.file object, comparing its size method with the "size" value. Trace how the upload response is represented and determine whether both access paths should report the same size; done means the discrepancy is explained and the expected behavior is covered by a regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100