Accept encoding attribute in files API

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-01-16 18:11:00 +02:00
parent 7001ad2dda
commit 4f2e9fb8e5
No known key found for this signature in database
GPG key ID: 627C5F589F467F17

View file

@ -18,7 +18,7 @@ module API
# #
post ":id/repository/files" do post ":id/repository/files" do
required_attributes! [:file_path, :branch_name, :content, :commit_message] required_attributes! [:file_path, :branch_name, :content, :commit_message]
attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message] attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message, :encoding]
branch_name = attrs.delete(:branch_name) branch_name = attrs.delete(:branch_name)
file_path = attrs.delete(:file_path) file_path = attrs.delete(:file_path)
result = ::Files::CreateContext.new(user_project, current_user, attrs, branch_name, file_path).execute result = ::Files::CreateContext.new(user_project, current_user, attrs, branch_name, file_path).execute
@ -48,7 +48,7 @@ module API
# #
put ":id/repository/files" do put ":id/repository/files" do
required_attributes! [:file_path, :branch_name, :content, :commit_message] required_attributes! [:file_path, :branch_name, :content, :commit_message]
attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message] attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message, :encoding]
branch_name = attrs.delete(:branch_name) branch_name = attrs.delete(:branch_name)
file_path = attrs.delete(:file_path) file_path = attrs.delete(:file_path)
result = ::Files::UpdateContext.new(user_project, current_user, attrs, branch_name, file_path).execute result = ::Files::UpdateContext.new(user_project, current_user, attrs, branch_name, file_path).execute