diff --git a/app/controllers/concerns/git_helper.rb b/app/controllers/concerns/git_helper.rb index 7c031f24c..d8479d458 100644 --- a/app/controllers/concerns/git_helper.rb +++ b/app/controllers/concerns/git_helper.rb @@ -46,6 +46,12 @@ module GitHelper content: content, author_name: username, author_email: mail) end + def update_file_base64_content(content, repo_path, path, mail, username, message) + content = Base64.encode64(content) + GitService.update_file_base64(repo_path: repo_path, file_path: path, message: message, + content: content, author_name: username, author_email: mail) + end + # 添加目录 def git_add_folder(folder_path, author_name, author_email, message) GitService.add_tree(file_path: folder_path, message: message, author_name: author_name, author_email: author_email) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 35aee9ffa..de69bf033 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -896,7 +896,7 @@ class ShixunsController < ApplicationController author_email = current_user.git_mail message = params[:message] || "upload file by browser" uid_logger("-----author_email: #{author_email}") - update_file_content(content, @repo_path, @path, author_email, author_name, message) + update_file_base64_content(content, @repo_path, @path, author_email, author_name, message) render_ok end