Skip to content

Commit

Permalink
File is mandatory in update
Browse files Browse the repository at this point in the history
Blame does not help, the `content` check was there from the beginning.

It is possible that a certain point in the past it was possible to
update the title with `update_document`, but now there is a dedicated
action and this action will raise a

```
Colore::Errors::ClientError: Invalid parameter file
```

if a user attempts to update a file without the content
  • Loading branch information
tagliala committed Jan 20, 2025
1 parent be8e2f9 commit e35e46e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/colore/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def create_document(doc_id:, filename:, content:, title: nil, author: nil, actio
# results of the conversion in it
#
# @return [Hash] a standard response
def update_document(doc_id:, filename:, content: nil, author: nil, actions: nil, callback_url: nil)
def update_document(doc_id:, filename:, content:, author: nil, actions: nil, callback_url: nil)
params = {}
params[:actions] = actions if actions
params[:author] = author if author
Expand All @@ -114,12 +114,8 @@ def update_document(doc_id:, filename:, content: nil, author: nil, actions: nil,
base_filename = File.basename(filename)

response = nil
if content
with_tempfile(content) do |io|
params[:file] = file_param(io)
response = send_request :post, "#{url_for_base(doc_id)}/#{encode_param(base_filename)}", params, :json
end
else
with_tempfile(content) do |io|
params[:file] = file_param(io)
response = send_request :post, "#{url_for_base(doc_id)}/#{encode_param(base_filename)}", params, :json
end
response
Expand Down

0 comments on commit e35e46e

Please sign in to comment.