Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/ruby-box/folder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ def upload_file(filename, data, overwrite=true)
# This is a workaround around:
begin
# were were given context information about this conflict?
file = RubyBox::File.new(@session, {
'id' => e['context_info']['conflicts'][0]['id']
})
rescue
# conflicts an either be an array or a hash
if (context_info = e['context_info']) && (conflicts = context_info['conflicts']) && (conflict = [conflicts].flatten(1).first) && (id = conflict['id'])
file = RubyBox::File.new(@session, {
'id' => id
})
else
# we were not given context information about this conflict.
# attempt to lookup the file.
file = files(filename, 1000).pop
Expand Down