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

After client.files_upload, message.file.size != message.file["size"] #294

Open
rangerscience opened this issue Jul 30, 2019 · 1 comment

Comments

@rangerscience
Copy link

rangerscience commented Jul 30, 2019

      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?

@dblock
Copy link
Collaborator

dblock commented Jul 31, 2019

This is a problem.

We wrap responses with a Hashie::Mash and what you're getting is the size of the hash instead of the value in it. You should write a spec to demonstrate it and we can see if we can fix it. I suspect that for the responses where we know there's a .size we can implement that method explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants