Bad offset exception when uploading binary file with session interface
rsae opened this issue · 2 comments
I was testing uploading via sessions and found that I got an offset error when trying to upload binary files. I believe I tracked it down to upload_session_start.rb line 34, where
"offset" => content.size
I believe that this should be
"offset" => content.bytesize
size returns the character length, whereas bytesize returns the length of the string in bytes. These sizes may not be the same if the file is not pure text.
I was able to create a new cursor with the content.bytesize and pass it to upload_session_finish and the file transferred properly.
Thanks for your work on this API. It's been a big timesaver.
You're right I should have used bytesize
, many thanks for the help!
Anytime. Your work on this lib is greatly appreciated.