UP-nxt / cmis-ruby

Ruby client for CMIS
Apache License 2.0
19 stars 12 forks source link

Excel file upload via multipart recurses forever. #34

Open rcuhljr opened 4 years ago

rcuhljr commented 4 years ago

As a note, the patch in cmis-ruby breaks the ability to upload an excel file via the multipart file upload as it enters an infinite loop in the new/initialize step.

Using the code

    document = folder.children.results.find { |d| d.name == file_name }

    unless document
      document = @repository.new_document
      document.name = file_name
      document.object_type_id = 'cmis:document'
      document = document.create_in_folder(folder)
    end

    document.content = { stream: file_contents, mime_type: Mime[:xlsx].to_s, filename: file_name }

Will render the following error upon reaching the last line and trying to set content.

/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/cmis-ruby-0.5.36/lib/cmis.rb:28:in `initialize'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/cmis-ruby-0.5.36/lib/cmis.rb:28:in `initialize'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/cmis-ruby-0.5.36/lib/cmis.rb:28:in `initialize'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/cmis-ruby-0.5.36/lib/cmis.rb:28:in `initialize'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/multipart-post-2.1.1/lib/parts.rb:14:in `new'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/multipart-post-2.1.1/lib/parts.rb:14:in `new'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/faraday-0.17.0/lib/faraday/request/multipart.rb:39:in `block in create_multipart'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/faraday-0.17.0/lib/faraday/request/multipart.rb:63:in `block in process_params'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/faraday-0.17.0/lib/faraday/request/multipart.rb:53:in `each'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/faraday-0.17.0/lib/faraday/request/multipart.rb:53:in `inject'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/faraday-0.17.0/lib/faraday/request/multipart.rb:53:in `process_params'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/faraday-0.17.0/lib/faraday/request/multipart.rb:38:in `create_multipart'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/faraday-0.17.0/lib/faraday/request/multipart.rb:13:in `block in call'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/faraday-0.17.0/lib/faraday/request/url_encoded.rb:21:in `match_content_type'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/faraday-0.17.0/lib/faraday/request/multipart.rb:10:in `call'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/cmis-ruby-0.5.36/lib/cmis/connection/request_modifier.rb:13:in `call'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/faraday-0.17.0/lib/faraday/rack_builder.rb:143:in `build_response'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/faraday-0.17.0/lib/faraday/connection.rb:387:in `run_request'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/faraday-0.17.0/lib/faraday/connection.rb:175:in `post'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/cmis-ruby-0.5.36/lib/cmis/connection.rb:39:in `do_request'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/cmis-ruby-0.5.36/lib/cmis/server.rb:18:in `execute!'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/cmis-ruby-0.5.36/lib/cmis/document.rb:85:in `block in content='
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/cmis-ruby-0.5.36/lib/cmis/helpers.rb:18:in `with_change_token'
/Users/rob/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/cmis-ruby-0.5.36/lib/cmis/document.rb:84:in `content='
SNIP
[2020-08-18 17:25:46.997] ERROR -- stack level too deep