Skip to content

Commit

Permalink
Update guard clause to prevent unless with complex condition in room …
Browse files Browse the repository at this point in the history
…file upload hash
  • Loading branch information
MrRTi committed Sep 20, 2023
1 parent 9761f19 commit fa9b847
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rocket_chat/messages/room.rb
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ def file_upload_hash(**params)
# NOTE: https://www.rubydoc.info/github/ruby/ruby/Net/HTTPHeader:set_form
file_options = params.slice(:filename, :content_type).compact
hash.map do |key, value|
next [key, value] unless key == :file && file_options.keys.any?
next [key, value, file_options] if key == :file && file_options.keys.any?

[key, value, file_options]
[key, value]
end
end
end
Expand Down

0 comments on commit fa9b847

Please sign in to comment.