Skip to content
Snippets Groups Projects
Verified Commit 54113319 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Use rugged in web editor for base64 encoding

parent d9d9c7d7
No related branches found
No related tags found
No related merge requests found
Loading
@@ -33,23 +33,20 @@ module Files
Loading
@@ -33,23 +33,20 @@ module Files
end end
end end
   
if params[:encoding] == 'base64' content =
new_file_action = Gitlab::Satellite::NewFileAction.new(current_user, project, ref, file_path) if params[:encoding] == 'base64'
created_successfully = new_file_action.commit!( Base64.decode64(params[:content])
params[:content], else
params[:commit_message], params[:content]
params[:encoding], end
params[:new_branch]
) created_successfully = repository.commit_file(
else current_user,
created_successfully = repository.commit_file( file_path,
current_user, content,
file_path, params[:commit_message],
params[:content], params[:new_branch] || ref
params[:commit_message], )
params[:new_branch] || ref
)
end
   
   
if created_successfully if created_successfully
Loading
Loading
Loading
@@ -19,23 +19,20 @@ module Files
Loading
@@ -19,23 +19,20 @@ module Files
return error("You can only edit text files") return error("You can only edit text files")
end end
   
if params[:encoding] == 'base64' content =
edit_file_action = Gitlab::Satellite::EditFileAction.new(current_user, project, ref, path) if params[:encoding] == 'base64'
edit_file_action.commit!( Base64.decode64(params[:content])
params[:content], else
params[:commit_message], params[:content]
params[:encoding], end
params[:new_branch]
) repository.commit_file(
else current_user,
repository.commit_file( path,
current_user, content,
path, params[:commit_message],
params[:content], params[:new_branch] || ref
params[:commit_message], )
params[:new_branch] || ref
)
end
   
success success
rescue Gitlab::Satellite::CheckoutFailed => ex rescue Gitlab::Satellite::CheckoutFailed => ex
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment