|
|
|
@@ -24,7 +24,7 @@ module Gitea |
|
|
|
|
|
|
|
def run |
|
|
|
Contents::UpdateForm.new(valid_params).validate! |
|
|
|
response = Gitea::Repository::Entries::UpdateService.new(token, owner, @params[:identifier], @params[:filepath], file_params).call |
|
|
|
response = Gitea::Repository::Entries::UpdateService.new(token, owner, @params[:identifier], file_path, file_params).call |
|
|
|
render_result(response) |
|
|
|
rescue Exception => exception |
|
|
|
fail!(exception.message) |
|
|
|
@@ -45,9 +45,25 @@ module Gitea |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
def file_path |
|
|
|
if @params[:base64_filepath].present? |
|
|
|
Base64.decode64(params[:base64_filepath]) |
|
|
|
else |
|
|
|
@params[:filepath] |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
def from_file_path |
|
|
|
if @params[:base64_from_path].present? |
|
|
|
Base64.decode64(params[:base64_from_path]) |
|
|
|
else |
|
|
|
@params[:from_path] |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
def valid_params |
|
|
|
{ |
|
|
|
filepath: @params[:filepath], |
|
|
|
filepath: file_path, |
|
|
|
branch: @params[:branch], |
|
|
|
new_branch: @params[:new_branch], |
|
|
|
sha: @params[:sha] |
|
|
|
@@ -59,7 +75,7 @@ module Gitea |
|
|
|
branch: @params[:branch], |
|
|
|
sha: @params[:sha], |
|
|
|
new_branch: @params[:new_branch], |
|
|
|
from_path: @params[:from_path], |
|
|
|
from_path: from_file_path, |
|
|
|
message: @params[:message], |
|
|
|
content: Base64.encode64(@params[:content]) |
|
|
|
).compact |
|
|
|
|