Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-08-11 12:50:48 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-08-11 12:50:48 +0300
commit815e678c4e331df49ee080af149253be008faf76 (patch)
treea187a494a55eca59fe33d7d5bad9c31231a77406 /app/services
parent34975f0180b209cf3ac7cbe5955f83c10aa4c210 (diff)
Revert "Use rugged in web editor for base64 encoding"
This reverts commit 541133197be098732cdc14a12aa059e21cac3d71.
Diffstat (limited to 'app/services')
-rw-r--r--app/services/files/create_service.rb31
-rw-r--r--app/services/files/update_service.rb31
2 files changed, 34 insertions, 28 deletions
diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb
index 3516cf30dbc..21065f71510 100644
--- a/app/services/files/create_service.rb
+++ b/app/services/files/create_service.rb
@@ -33,20 +33,23 @@ module Files
end
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 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
if created_successfully
diff --git a/app/services/files/update_service.rb b/app/services/files/update_service.rb
index 4d7ac3b7504..5efd43d16ce 100644
--- a/app/services/files/update_service.rb
+++ b/app/services/files/update_service.rb
@@ -19,20 +19,23 @@ module Files
return error("You can only edit text files")
end
- content =
- if params[:encoding] == 'base64'
- Base64.decode64(params[:content])
- else
- params[:content]
- end
-
- repository.commit_file(
- current_user,
- path,
- content,
- params[:commit_message],
- params[:new_branch] || ref
- )
+ if params[:encoding] == 'base64'
+ edit_file_action = Gitlab::Satellite::EditFileAction.new(current_user, project, ref, path)
+ edit_file_action.commit!(
+ params[:content],
+ params[:commit_message],
+ params[:encoding],
+ params[:new_branch]
+ )
+ else
+ repository.commit_file(
+ current_user,
+ path,
+ params[:content],
+ params[:commit_message],
+ params[:new_branch] || ref
+ )
+ end
success
rescue Gitlab::Satellite::CheckoutFailed => ex