Commit 54113319 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Use rugged in web editor for base64 encoding

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent d9d9c7d7
......@@ -33,23 +33,20 @@ module Files
end
end
content =
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]
)
Base64.decode64(params[:content])
else
params[:content]
end
created_successfully = repository.commit_file(
current_user,
file_path,
params[:content],
content,
params[:commit_message],
params[:new_branch] || ref
)
end
if created_successfully
......
......@@ -19,23 +19,20 @@ module Files
return error("You can only edit text files")
end
content =
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]
)
Base64.decode64(params[:content])
else
params[:content]
end
repository.commit_file(
current_user,
path,
params[:content],
content,
params[:commit_message],
params[:new_branch] || ref
)
end
success
rescue Gitlab::Satellite::CheckoutFailed => ex
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment