diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-02 00:43:35 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-02 00:43:35 +0300 |
commit | 541133197be098732cdc14a12aa059e21cac3d71 (patch) | |
tree | be98768f2f5de5ded78beaebd582b96bebc1795c /app/services/files/create_service.rb | |
parent | d9d9c7d7bcb55fe8aa950464ffc691080eff9352 (diff) |
Use rugged in web editor for base64 encoding
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/services/files/create_service.rb')
-rw-r--r-- | app/services/files/create_service.rb | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb index 21065f71510..3516cf30dbc 100644 --- a/app/services/files/create_service.rb +++ b/app/services/files/create_service.rb @@ -33,23 +33,20 @@ module Files end end - if params[:encoding] == 'base64' - new_file_action = Gitlab::Satellite::NewFileAction.new(current_user, project, ref, file_path) - created_successfully = new_file_action.commit!( - params[:content], - params[:commit_message], - params[:encoding], - params[:new_branch] - ) - else - created_successfully = repository.commit_file( - current_user, - file_path, - params[:content], - params[:commit_message], - params[:new_branch] || ref - ) - end + content = + if params[:encoding] == 'base64' + Base64.decode64(params[:content]) + else + params[:content] + end + + created_successfully = repository.commit_file( + current_user, + file_path, + content, + params[:commit_message], + params[:new_branch] || ref + ) if created_successfully |