I've been experimenting with the upload session API, and I think I've found a bug not covered by the current test cases.
commit = DropboxApi::Metadata::CommitInfo.new({
"path" => "/test.txt",
"mode" => :add
})
# Upload the first three bytes
cursor = client.upload_session_start('abc')
# Cursor offset has been correctly set to 3 at this point
expect(cursor.offset).to eq(3)
# Upload the second three bytes
client.upload_session_append_v2(cursor, 'def')
# Cursor offset *should* be set to 6 at this point, but remains 3
# expect(cursor.offset).to eq(6)
# Attempt to commit the upload
client.upload_session_finish(cursor, commit)
There are test cases covering upload_session_append_v2 and upload_session_finish, but never the two together, which would otherwise reveal this problem.
I believe the correct behaviour is to have upload_session_append_v2 update the cursors offset after a successful request, and I'm working on a fix for this at the moment – let me know if you have any thoughts on this in the meantime.
I've been experimenting with the upload session API, and I think I've found a bug not covered by the current test cases.
This raises an error:
This happens because the offset of the cursor never changes from 3 to 6 after the call to
upload_session_append_v2
.This hack will cause the test to pass:
There are test cases covering
upload_session_append_v2
andupload_session_finish
, but never the two together, which would otherwise reveal this problem.I believe the correct behaviour is to have
upload_session_append_v2
update the cursors offset after a successful request, and I'm working on a fix for this at the moment – let me know if you have any thoughts on this in the meantime.